net.sf.farrago.util
Class FarragoCacheEntry
java.lang.Object
net.sf.farrago.util.FarragoCacheEntry
- All Implemented Interfaces:
- FarragoAllocation, FarragoObjectCache.Entry, FarragoObjectCache.UninitializedEntry, ClosableAllocation
public class FarragoCacheEntry
- extends Object
- implements FarragoObjectCache.Entry, FarragoObjectCache.UninitializedEntry
FarragoCacheEntry implements the interfaces for a cache entry.
- Version:
- $Id: //open/dev/farrago/src/net/sf/farrago/util/FarragoCacheEntry.java#10 $
key
Object key
value
Object value
pinCount
int pinCount
memoryUsage
AtomicLong memoryUsage
constructionThread
Thread constructionThread
isReusable
boolean isReusable
isInitialized
boolean isInitialized
parentCache
FarragoObjectCache parentCache
- The cache this entry is associated with
FarragoCacheEntry
public FarragoCacheEntry(FarragoObjectCache parentCache)
getKey
public Object getKey()
- Specified by:
getKey
in interface FarragoObjectCache.Entry
- Returns:
- the key of this entry (as passed to the
FarragoObjectCache.pin(java.lang.Object, net.sf.farrago.util.FarragoObjectCache.CachedObjectFactory, boolean)
method).
getValue
public Object getValue()
- Specified by:
getValue
in interface FarragoObjectCache.Entry
- Returns:
- the value cached by this entry (as set by
FarragoObjectCache.UninitializedEntry.initialize(java.lang.Object, long, boolean)
).
isReusable
public boolean isReusable()
initialize
public void initialize(Object value,
long memoryUsage,
boolean isReusable)
- Description copied from interface:
FarragoObjectCache.UninitializedEntry
- Initializes the entry.
- Specified by:
initialize
in interface FarragoObjectCache.UninitializedEntry
- Parameters:
value
- the value to associate with the entry's key; if this
Object implements FarragoAllocation, it will be closed when discarded
from the cachememoryUsage
- approximate total number of bytes of memory used
by entry (combination of key, value, and any sub-objects)isReusable
- whether the initialized entry is reusable; if
false, the entry will be returned as private to the original caller
of FarragoObjectCache.pin(java.lang.Object, net.sf.farrago.util.FarragoObjectCache.CachedObjectFactory, boolean)
, and no other callers will ever be able to pin it
closeAllocation
public void closeAllocation()
- Description copied from interface:
ClosableAllocation
- Closes this object.
- Specified by:
closeAllocation
in interface ClosableAllocation
toString
public String toString()
- Overrides:
toString
in class Object
isInitialized
boolean isInitialized()
- Returns:
- whether
initialize(java.lang.Object, long, boolean)
has been called yet