Class Version

  • All Implemented Interfaces:
    java.lang.Comparable<Timestamp>, Timestamp

    public class Version
    extends java.lang.Object
    implements Timestamp
    Logical timestamp for versions.

    The version is a logical timestamp that represents a point in logical time at which an event occurs. This is used in both pessimistic and optimistic locking protocols to ensure that the state of a shared resource has not changed at the end of a transaction.

    • Constructor Detail

      • Version

        public Version​(long version)
    • Method Detail

      • compareTo

        public int compareTo​(Timestamp o)
        Specified by:
        compareTo in interface java.lang.Comparable<Timestamp>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface Timestamp
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface Timestamp
        Overrides:
        equals in class java.lang.Object
      • toString

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

        public long value()
        Returns the lock version.
        Returns:
        the lock version