public class SharedCache extends Object implements StorageCacheIF, AccessRegistrarIF
| Modifier and Type | Field and Description |
|---|---|
protected ClusterIF |
cluster |
protected TicketIF |
current_ticket |
protected long |
current_ticket_value |
protected Map<IdentityIF,CacheEntry> |
datacache |
protected int |
eviction |
protected Map<Object,Integer> |
field_counts |
protected StorageIF |
storage |
protected long |
timestamp |
| Modifier and Type | Method and Description |
|---|---|
void |
clear(boolean notifyCluster)
INTERNAL: Clears the cache.
|
void |
close()
INTERNAL: Releases all resources used by the storage cache.
|
IdentityIF |
createIdentity(Class<?> type,
long key)
INTERNAL: Factory method for creating new identity objects.
|
IdentityIF |
createIdentity(Class<?> type,
Object key)
INTERNAL: Factory method for creating new identity objects.
|
IdentityIF |
createIdentity(Class<?> type,
Object[] keys)
INTERNAL: Factory method for creating new identity objects.
|
void |
evictField(IdentityIF identity,
int field,
boolean notifyCluster)
INTERNAL: Evict the identity's field value from the cache.
|
void |
evictFields(IdentityIF identity,
boolean notifyCluster)
INTERNAL: Evict all the identity's field values from the cache.
|
void |
evictIdentity(IdentityIF identity,
boolean notifyCluster)
INTERNAL: Evict the identity from the cache.
|
boolean |
exists(StorageAccessIF access,
IdentityIF identity)
INTERNAL: Can be called to verify whether the specified identity
exists in the cache or in the data repository.
|
protected int |
getFieldsCount(Class<?> type) |
AccessRegistrarIF |
getRegistrar()
INTERNAL: Returns the access registrar instance that is used by
the storage cache.
|
TicketIF |
getTicket()
INTERNAL: Get ticket that should be used as first argument to
register methods.
|
Object |
getValue(StorageAccessIF access,
IdentityIF identity,
int field)
INTERNAL: A call forwarded by the transaction (TransactionIF)
from persistent objects (PersistentIF) when the field value needs
to be retrieved from storage.
|
boolean |
isFieldLoaded(IdentityIF identity,
int field)
INTERNAL: Can be called to check if the specfied field has been
registered with the cache.
|
boolean |
isObjectLoaded(IdentityIF identity)
INTERNAL: Can be called to check if the identity has been
registered with the cache.
|
int |
prefetch(StorageAccessIF access,
Class<?> type,
int field,
int nextField,
boolean traverse,
Collection<IdentityIF> identities) |
void |
registerEviction()
INTERNAL: Tells the cache that eviction is starting.
|
void |
registerField(TicketIF ticket,
IdentityIF identity,
int field,
Object value)
INTERNAL: Called by storage accessors (FieldAccessIF) when they
read the value of an object field from the database.
|
void |
registerIdentity(TicketIF ticket,
IdentityIF identity)
INTERNAL: Called by storage accessors (QueryIFs or FieldAccessIF)
when they locate the identity of an object in the database.
|
void |
releaseEviction()
INTERNAL: Deregister eviction.
|
void |
setCluster(ClusterIF cluster) |
String |
toString() |
void |
writeReport(Writer out,
boolean dumpCache) |
protected StorageIF storage
protected Map<IdentityIF,CacheEntry> datacache
protected long current_ticket_value
protected TicketIF current_ticket
protected int eviction
protected ClusterIF cluster
protected long timestamp
public void setCluster(ClusterIF cluster)
public AccessRegistrarIF getRegistrar()
StorageCacheIFgetRegistrar in interface StorageCacheIFpublic void close()
StorageCacheIFclose in interface StorageCacheIFpublic boolean exists(StorageAccessIF access, IdentityIF identity)
StorageCacheIFexists in interface StorageCacheIFpublic Object getValue(StorageAccessIF access, IdentityIF identity, int field)
StorageCacheIFgetValue in interface StorageCacheIFpublic boolean isObjectLoaded(IdentityIF identity)
StorageCacheIFisObjectLoaded in interface StorageCacheIFpublic boolean isFieldLoaded(IdentityIF identity, int field)
StorageCacheIFisFieldLoaded in interface StorageCacheIFpublic void evictIdentity(IdentityIF identity, boolean notifyCluster)
StorageCacheIFevictIdentity in interface StorageCacheIFpublic void evictFields(IdentityIF identity, boolean notifyCluster)
StorageCacheIFevictFields in interface StorageCacheIFpublic void evictField(IdentityIF identity, int field, boolean notifyCluster)
StorageCacheIFevictField in interface StorageCacheIFpublic int prefetch(StorageAccessIF access, Class<?> type, int field, int nextField, boolean traverse, Collection<IdentityIF> identities)
prefetch in interface StorageCacheIFpublic IdentityIF createIdentity(Class<?> type, long key)
AccessRegistrarIFcreateIdentity in interface AccessRegistrarIFpublic IdentityIF createIdentity(Class<?> type, Object key)
AccessRegistrarIFcreateIdentity in interface AccessRegistrarIFpublic IdentityIF createIdentity(Class<?> type, Object[] keys)
AccessRegistrarIFcreateIdentity in interface AccessRegistrarIFpublic void registerIdentity(TicketIF ticket, IdentityIF identity)
AccessRegistrarIFregisterIdentity in interface AccessRegistrarIFpublic void registerField(TicketIF ticket, IdentityIF identity, int field, Object value)
AccessRegistrarIFregisterField in interface AccessRegistrarIFpublic TicketIF getTicket()
AccessRegistrarIFgetTicket in interface AccessRegistrarIFpublic void registerEviction()
StorageCacheIFregisterEviction in interface StorageCacheIFpublic void releaseEviction()
StorageCacheIFreleaseEviction in interface StorageCacheIFprotected int getFieldsCount(Class<?> type)
public void clear(boolean notifyCluster)
StorageCacheIFclear in interface StorageCacheIFpublic void writeReport(Writer out, boolean dumpCache) throws IOException
IOException