java.lang.Object
com.hazelcast.hibernate.serialization.Expirable
com.hazelcast.hibernate.serialization.ExpiryMarker
All Implemented Interfaces:
com.hazelcast.nio.serialization.DataSerializable, com.hazelcast.nio.serialization.IdentifiedDataSerializable, Serializable

public class ExpiryMarker extends Expirable implements Serializable
An entry which is marked for expiration. This can occur when Hibernate is expecting to update an entry as a result of changes being made in an in-progress transaction

Such an entry has the following properties

  • It will always return a null value, resulting in a cache miss
  • It is only replaceable when it is completely expired
  • It can be marked by multiple transactions at the same time and will not expire until all transactions complete
  • It should not be expired unless matches(ExpiryMarker) is true
See Also:
  • Constructor Details

    • ExpiryMarker

      public ExpiryMarker()
    • ExpiryMarker

      public ExpiryMarker(Object version, long timeout, String markerId)
  • Method Details

    • isReplaceableBy

      public boolean isReplaceableBy(long txTimestamp, Object newVersion, Comparator versionComparator)
      Description copied from class: Expirable
      Determine if the current entry can be overridden with a value corresponding to the given new version and the transaction timestamp.
      Specified by:
      isReplaceableBy in class Expirable
      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 Object getValue()
      Specified by:
      getValue in class Expirable
      Returns:
      the value contained, or null if none exists
    • getValue

      public Object getValue(long txTimestamp)
      Specified by:
      getValue in class Expirable
      Parameters:
      txTimestamp - the timestamp of the transaction
      Returns:
      the value contained if it was created before the transaction timestamp or null
    • matches

      public boolean matches(ExpiryMarker lock)
      Specified by:
      matches in class Expirable
      Returns:
      true if the Expirable matches using the specified lock, false otherwise
      See Also:
    • isConcurrent

      public boolean isConcurrent()
      Returns:
      true if the marker has ever been markForExpiration(long, String) concurrently, false otherwise
    • markForExpiration

      public ExpiryMarker markForExpiration(long timeout, String nextMarkerId)
      Description copied from class: Expirable
      Mark the entry for expiration with the given timeout and marker id.

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

      Specified by:
      markForExpiration in class Expirable
      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:
    • expire

      public ExpiryMarker expire(long timestamp)
      Expire the marker. The marker may have been marked multiple times so it may still not be replaceable.
      Parameters:
      timestamp - the timestamp to specify when it was completely expired
      Returns:
      a new ExpiryMarker
    • writeData

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

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

      public int getFactoryId()
      Specified by:
      getFactoryId in interface com.hazelcast.nio.serialization.IdentifiedDataSerializable
    • getClassId

      public int getClassId()
      Specified by:
      getClassId in interface com.hazelcast.nio.serialization.IdentifiedDataSerializable