FileDocCategorySizeDatePackage
WeakCacheKey.javaAPI DocGlassfish v2 API3454Tue May 22 16:54:36 BST 2007oracle.toplink.essentials.internal.identitymaps

WeakCacheKey

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 no and then.

Responsibilities:

  • Hold key and object.
  • Maintain and update the current writeLockValue.
since
TOPLink/Java 1.0

Fields Summary
protected WeakReference
reference
Reference is maintained weak to allow garbage collection
Constructors Summary
public WeakCacheKey(Vector primaryKey, Object object, Object writeLockValue, long readTime)
Initialize the newly allocated instance of this class.

param
primaryKey contains values extracted from the object
param
writeLockValue is the write lock value, null if optimistic locking not being used for this object.
param
readTime the time TopLInk read the cache key

        super(primaryKey, object, writeLockValue, readTime);
    
Methods Summary
public java.lang.ObjectgetObject()

        return getReference().get();
    
public java.lang.ref.WeakReferencegetReference()

        return reference;
    
public voidsetObject(java.lang.Object object)

        setReference(new WeakReference(object));
    
protected voidsetReference(java.lang.ref.WeakReference reference)

        this.reference = reference;