Enum ReplicatedRegister.Clock

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      CUSTOM
      A custom clock.
      CUSTOM_AUTO_INCREMENT
      A custom clock, that automatically increments the custom value if the local clock value is greater than it.
      DEFAULT
      The default clock, uses the current system time as the clock value.
      REVERSE
      A reverse clock, based on the system clock.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ReplicatedRegister.Clock valueOf​(String name)
      Returns the enum constant of this type with the specified name.
      static ReplicatedRegister.Clock[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • DEFAULT

        public static final ReplicatedRegister.Clock DEFAULT
        The default clock, uses the current system time as the clock value.
      • REVERSE

        public static final ReplicatedRegister.Clock REVERSE
        A reverse clock, based on the system clock.

        Using this effectively achieves First-Write-Wins semantics.

        This is susceptible to the same clock skew problems as the default clock.

      • CUSTOM

        public static final ReplicatedRegister.Clock CUSTOM
        A custom clock.

        The custom clock value is passed by using the customClockValue parameter on the ReplicatedRegister.set(Object, Clock, long) method. The value should be a domain specific monotonically increasing value. For example, if the source of the value for this register is a single device, that device may attach a sequence number to each update, that sequence number can be used to guarantee that the register will converge to the last update emitted by that device.

      • CUSTOM_AUTO_INCREMENT

        public static final ReplicatedRegister.Clock CUSTOM_AUTO_INCREMENT
        A custom clock, that automatically increments the custom value if the local clock value is greater than it.

        This is like CUSTOM, however if when performing the update in the proxy, it's found that the clock value of the register is greater than the specified clock value for the update, the proxy will instead use the current clock value of the register plus one.

        This can guarantee that updates done on the same node will be causally ordered (addressing problems caused by the system clock being adjusted), but will not guarantee causal ordering for updates on different nodes, since it's possible that an update on a different node has not yet been replicated to this node.

    • Method Detail

      • values

        public static ReplicatedRegister.Clock[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ReplicatedRegister.Clock c : ReplicatedRegister.Clock.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ReplicatedRegister.Clock valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null