Package akka.cluster

Class VectorClock

  • All Implemented Interfaces:
    java.io.Serializable, scala.Equals, scala.Product

    public final class VectorClock
    extends java.lang.Object
    implements scala.Product, java.io.Serializable
    See Also:
    Serialized Form
    • Constructor Detail

      • VectorClock

        public VectorClock​(scala.collection.immutable.TreeMap<java.lang.String,​java.lang.Object> versions)
    • Method Detail

      • $lessinit$greater$default$1

        public static scala.collection.immutable.TreeMap<java.lang.String,​java.lang.Object> $lessinit$greater$default$1()
        Representation of a Vector-based clock (counting clock), inspired by Lamport logical clocks.
        
         Reference:
            1) Leslie Lamport (1978). "Time, clocks, and the ordering of events in a distributed system". Communications of the ACM 21 (7): 558-565.
            2) Friedemann Mattern (1988). "Virtual Time and Global States of Distributed Systems". Workshop on Parallel and Distributed Algorithms: pp. 215-226
         

        Based on code from the 'vlock' VectorClock library by Coda Hale.

      • apply

        public static VectorClock apply​(scala.collection.immutable.TreeMap<java.lang.String,​java.lang.Object> versions)
      • apply$default$1

        public static scala.collection.immutable.TreeMap<java.lang.String,​java.lang.Object> apply$default$1()
      • unapply

        public static scala.Option<scala.collection.immutable.TreeMap<java.lang.String,​java.lang.Object>> unapply​(VectorClock x$0)
      • versions

        public scala.collection.immutable.TreeMap<java.lang.String,​java.lang.Object> versions()
      • $colon$plus

        public VectorClock $colon$plus​(java.lang.String node)
        Increment the version for the node passed as argument. Returns a new VectorClock.
      • $less$greater

        public boolean $less$greater​(VectorClock that)
        Returns true if this and that are concurrent else false.
      • $less

        public boolean $less​(VectorClock that)
        Returns true if this is before that else false.
      • $greater

        public boolean $greater​(VectorClock that)
        Returns true if this is after that else false.
      • $eq$eq

        public boolean $eq$eq​(VectorClock that)
        Returns true if this VectorClock has the same history as the 'that' VectorClock else false.
      • compareTo

        public VectorClock.Ordering compareTo​(VectorClock that)
        Compare two vector clocks. The outcome will be one of the following:

        
           1. Clock 1 is SAME (==)       as Clock 2 iff for all i c1(i) == c2(i)
           2. Clock 1 is BEFORE (<)      Clock 2 iff for all i c1(i) <= c2(i) and there exist a j such that c1(j) < c2(j)
           3. Clock 1 is AFTER (>)       Clock 2 iff for all i c1(i) >= c2(i) and there exist a j such that c1(j) > c2(j).
           4. Clock 1 is CONCURRENT (<>) to Clock 2 otherwise.
         
      • merge

        public VectorClock merge​(VectorClock that)
        Merges this VectorClock with another VectorClock. E.g. merges its versioned history.
      • prune

        public VectorClock prune​(java.lang.String removedNode)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • copy

        public VectorClock copy​(scala.collection.immutable.TreeMap<java.lang.String,​java.lang.Object> versions)
      • copy$default$1

        public scala.collection.immutable.TreeMap<java.lang.String,​java.lang.Object> copy$default$1()
      • productPrefix

        public java.lang.String productPrefix()
        Specified by:
        productPrefix in interface scala.Product
      • productArity

        public int productArity()
        Specified by:
        productArity in interface scala.Product
      • productElement

        public java.lang.Object productElement​(int x$1)
        Specified by:
        productElement in interface scala.Product
      • productIterator

        public scala.collection.Iterator<java.lang.Object> productIterator()
        Specified by:
        productIterator in interface scala.Product
      • canEqual

        public boolean canEqual​(java.lang.Object x$1)
        Specified by:
        canEqual in interface scala.Equals
      • productElementName

        public java.lang.String productElementName​(int x$1)
        Specified by:
        productElementName in interface scala.Product
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object x$1)
        Specified by:
        equals in interface scala.Equals
        Overrides:
        equals in class java.lang.Object