|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkrati.sos.ObjectCacheAgent<T>
T
- Object to be cached.public class ObjectCacheAgent<T>
ObjectCacheAgent: An agent that wraps an ObjectCache can have inbound and outbound ObjectHandler(s). The inbound handler is associated with the set method. It is called on an inbound object before the object is passed down to the underlying ObjectCache. The outbound handler is associated with the get method. It is called on an outbound object before the object is returned back to the ObjectCache visitor. Either inbound or outbound handlers does not affect the delete method.
get(int objectId) + get object from the underlying store + Call the outbound handler on the object + return the object set(int objectId, T object, long scn) + Call the inbound handler on the value object + delegate operation set to the underlying store
Field Summary | |
---|---|
protected ObjectCache<T> |
_cache
|
protected ObjectHandler<T> |
_inboundHandler
|
protected ObjectHandler<T> |
_outboundHandler
|
Constructor Summary | |
---|---|
ObjectCacheAgent(ObjectCache<T> cache,
ObjectHandler<T> inboundHandler,
ObjectHandler<T> outboundHandler)
|
Method Summary | |
---|---|
void |
clear()
Clears this object cache by removing all the persisted data permanently. |
boolean |
delete(int objectId,
long scn)
Deletes an object based on a user-specified object Id. |
T |
get(int objectId)
Gets an object based on a user-specified object Id. |
byte[] |
getBytes(int objectId)
Gets an object in raw bytes based on a user-specified object Id. |
long |
getHWMark()
Gets the high water mark. |
ObjectHandler<T> |
getInboundHandler()
|
long |
getLWMark()
Gets the low water mark. |
ObjectCache<T> |
getObjectCache()
|
int |
getObjectIdCount()
|
int |
getObjectIdStart()
|
ObjectHandler<T> |
getOutboundHandler()
|
void |
persist()
Persists this object cache. |
void |
saveHWMark(long endOfPeriod)
Save the high water mark. |
boolean |
set(int objectId,
T object,
long scn)
Sets an object at a user-specified object Id. |
void |
sync()
Force all updates from memory buffer and redo log files to synchronize with the underlying persistent file in blocking mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ObjectCache<T> _cache
protected ObjectHandler<T> _inboundHandler
protected ObjectHandler<T> _outboundHandler
Constructor Detail |
---|
public ObjectCacheAgent(ObjectCache<T> cache, ObjectHandler<T> inboundHandler, ObjectHandler<T> outboundHandler)
Method Detail |
---|
public ObjectCache<T> getObjectCache()
public ObjectHandler<T> getInboundHandler()
public ObjectHandler<T> getOutboundHandler()
public int getObjectIdCount()
getObjectIdCount
in interface ObjectCache<T>
public int getObjectIdStart()
getObjectIdStart
in interface ObjectCache<T>
public boolean delete(int objectId, long scn) throws Exception
ObjectCache
delete
in interface ObjectCache<T>
objectId
- the object Id.scn
- the global scn (equivalent to a time stamp).
Exception
public boolean set(int objectId, T object, long scn) throws Exception
ObjectCache
set
in interface ObjectCache<T>
objectId
- the object Id.object
- the object to put into the cache.scn
- the global scn (equivalent to a time stamp).
Exception
public T get(int objectId)
ObjectCache
get
in interface ObjectCache<T>
objectId
- the Id of an object to be retrieved from the cache.
public void sync() throws IOException
Persistable
sync
in interface Persistable
IOException
public void persist() throws IOException
ObjectCache
persist
in interface Persistable
persist
in interface ObjectCache<T>
IOException
public void clear() throws IOException
ObjectCache
clear
in interface ObjectCache<T>
IOException
public long getHWMark()
Persistable
getHWMark
in interface Persistable
public long getLWMark()
Persistable
getLWMark
in interface Persistable
public void saveHWMark(long endOfPeriod) throws Exception
Persistable
saveHWMark
in interface Persistable
Exception
public byte[] getBytes(int objectId)
ObjectCache
getBytes
in interface ObjectCache<T>
objectId
- the Id of an object to be retrieved from the cache.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |