java.lang.Object
com.hazelcast.hibernate.serialization.Expirable
All Implemented Interfaces:
com.hazelcast.nio.serialization.DataSerializable, com.hazelcast.nio.serialization.IdentifiedDataSerializable
Direct Known Subclasses:
ExpiryMarker, Value

public abstract class Expirable extends Object implements com.hazelcast.nio.serialization.IdentifiedDataSerializable
A container class which represents an entry in a region cache which can be marked for expiration
  • Field Details

    • version

      protected Object version
  • Constructor Details

    • Expirable

      protected Expirable()
    • Expirable

      protected Expirable(Object version)
  • Method Details

    • isReplaceableBy

      public abstract boolean isReplaceableBy(long txTimestamp, Object newVersion, Comparator versionComparator)
      Determine if the current entry can be overridden with a value corresponding to the given new version and the transaction timestamp.
      Parameters:
      txTimestamp - the timestamp of the transaction
      newVersion - the new version for the replacement value
      versionComparator - the comparator to use for the version
      Returns:
      true if the value can be replaced, false otherwise
    • getValue

      public abstract Object getValue()
      Returns:
      the value contained, or null if none exists
    • getValue

      public abstract Object getValue(long txTimestamp)
      Parameters:
      txTimestamp - the timestamp of the transaction
      Returns:
      the value contained if it was created before the transaction timestamp or null
    • getVersion

      public Object getVersion()
      Returns:
      the version representing the value of null if the entry is not versioned
    • matches

      public abstract boolean matches(ExpiryMarker lock)
      Returns:
      true if the Expirable matches using the specified lock, false otherwise
      See Also:
    • markForExpiration

      public abstract ExpiryMarker markForExpiration(long timeout, String nextMarkerId)
      Mark the entry for expiration with the given timeout and marker id.

      For every invocation a corresponding call to ExpiryMarker.expire(long) should be made, provided that the returned marker matches(ExpiryMarker)

      Parameters:
      timeout - the timestamp in which the lock times out
      nextMarkerId - the next lock id to use if creating a new lock
      Returns:
      the newly created marker, or the current marker with a higher multiplicity
      See Also:
    • writeData

      public void writeData(com.hazelcast.nio.ObjectDataOutput out) throws IOException
      Specified by:
      writeData in interface com.hazelcast.nio.serialization.DataSerializable
      Throws:
      IOException
    • readData

      public void readData(com.hazelcast.nio.ObjectDataInput in) throws IOException
      Specified by:
      readData in interface com.hazelcast.nio.serialization.DataSerializable
      Throws:
      IOException
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object