Class WeakCacheKey

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    HardCacheWeakIdentityMap.ReferenceCacheKey, QueueableWeakCacheKey, SoftCacheKey

    public class WeakCacheKey
    extends CacheKey

    Purpose: Container class for storing objects in an IdentityMap. The weak cache key uses a weak reference to allow garbage collection of its object. The cache key itself however will remain and thus should cleaned up every now and then.

    Responsibilities:

    • Hold key and object.
    • Maintain and update the current writeLockValue.
    Since:
    TOPLink/Java 1.0
    See Also:
    Serialized Form
    • Field Detail

      • reference

        protected java.lang.ref.Reference reference
        Reference is maintained weak to allow garbage collection
    • Constructor Detail

      • WeakCacheKey

        public WeakCacheKey​(java.lang.Object primaryKey,
                            java.lang.Object object,
                            java.lang.Object writeLockValue,
                            long readTime,
                            boolean isIsolated)
        Initialize the newly allocated instance of this class.
        Parameters:
        primaryKey - contains values extracted from the object
        writeLockValue - is the write lock value, null if optimistic locking not being used for this object.
        readTime - the time EclipseLInk read the cache key
    • Method Detail

      • getObject

        public java.lang.Object getObject()
        Overrides:
        getObject in class CacheKey
      • setObject

        public void setObject​(java.lang.Object object)
        Overrides:
        setObject in class CacheKey