Class Revision

  • All Implemented Interfaces:
    org.apache.jackrabbit.oak.cache.CacheValue

    public final class Revision
    extends Object
    implements org.apache.jackrabbit.oak.cache.CacheValue
    A revision.
    • Constructor Detail

      • Revision

        public Revision​(long timestamp,
                        int counter,
                        int clusterId)
      • Revision

        public Revision​(long timestamp,
                        int counter,
                        int clusterId,
                        boolean branch)
    • Method Detail

      • getCurrentTimestamp

        public static long getCurrentTimestamp()
        Get the timestamp value of the current date and time. Within the same process, the returned value is never smaller than a previously returned value, even if the system time was changed.
        Returns:
        the timestamp
      • getTimestampDifference

        public static long getTimestampDifference​(Revision r1,
                                                  Revision r2)
        Get the timestamp difference between two revisions (r1 - r2) in milliseconds.
        Parameters:
        r1 - the first revision
        r2 - the second revision
        Returns:
        the difference in milliseconds
      • toStringBuilder

        public StringBuilder toStringBuilder​(StringBuilder sb)
        Appends the string representation of this revision to the given StringBuilder.
        Parameters:
        sb - a StringBuilder.
        Returns:
        the StringBuilder instance passed to this method.
      • toReadableString

        public String toReadableString()
      • getTimestamp

        public long getTimestamp()
        Get the timestamp in milliseconds since 1970.
        Returns:
        the timestamp
      • getCounter

        public int getCounter()
      • isBranch

        public boolean isBranch()
        Returns:
        true if this is a branch revision, otherwise false.
      • asBranchRevision

        public Revision asBranchRevision()
        Returns a revision with the same timestamp, counter and clusterId as this revision and the branch flag set to true.
        Returns:
        branch revision with this timestamp, counter and clusterId.
      • asTrunkRevision

        public Revision asTrunkRevision()
        Returns a revision with the same timestamp, counter and clusterId as this revision and the branch flag set to false.
        Returns:
        trunk revision with this timestamp, counter and clusterId.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getClusterId

        public int getClusterId()
      • getMemory

        public int getMemory()
        Specified by:
        getMemory in interface org.apache.jackrabbit.oak.cache.CacheValue