|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--goodsjpi.CacheManager
CacheManager may be used on a per Thread basis (see attatch
and detatch), or on a global basis (defaultCacheManager), to cache the
objects on client side and to keep transaction list.
Two caches are kept, a last recently used and a frequesntly used. Cache
and transaction list are kept as double linked lists.
| Constructor Summary | |
CacheManager()
Initialize all the double linked lists with empty Persistent objects. |
|
| Method Summary | |
void |
addToTransaction(goodsjpi.Persistent obj)
Include object in transaction list. |
void |
attach()
Associate cache manager with current thread. |
void |
detach()
Detach cache manager from current thread |
void |
detach(java.lang.Thread thread)
detach the given thread. |
void |
enter()
This method is called by Metaobject.preDaemon to determine start of access to the database |
void |
forgetObject(goodsjpi.Persistent obj)
Place object in forgotten list |
static goodsjpi.CacheManager |
getCacheManager()
getCacheManager the current manager. |
void |
insertInCache(goodsjpi.Persistent obj)
insertInCache insert object in one of two cache LRU lists
depending on its current
state. |
void |
leave()
This method is called by Metaobject.postDaemon to determine end of access to the database |
static void |
linkAfter(goodsjpi.Persistent after,
goodsjpi.Persistent obj)
Link the given object after the other. |
static void |
linkBefore(goodsjpi.Persistent before,
goodsjpi.Persistent obj)
linkBefore links "obj" before "before" such that obj.next
== before. |
void |
removeFromCache(goodsjpi.Database db)
Remove from cache all objects from the specified database |
void |
removeFromCache(goodsjpi.Persistent obj)
Exclude object from LRU list so making it not available for cached objects LRU relpacing algorithm. |
void |
setCacheLimits(int l0,
int l1)
Set new limits for object cache. |
void |
setFreeMemoryWatermark(long watermark)
Set new watermark for minimal size of fee memory |
static void |
unlink(goodsjpi.Persistent obj)
unlink the given object so that obj.next.prev = obj.prev
and obj.prev.next = obj.next . |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CacheManager()
| Method Detail |
public static goodsjpi.CacheManager getCacheManager()
getCacheManager the current manager. This is the per-thread
manager that has called attatch() or the default one if attatch has never
been called on the current thread.
CacheManager value, see above.public void attach()
public void detach()
public void detach(java.lang.Thread thread)
detach the given thread. Removes the associated cache
manager from the hashtable (cacheManagerHash)
thread - a Thread to detatch
public static void linkAfter(goodsjpi.Persistent after,
goodsjpi.Persistent obj)
after - a Persistent value, to link obj afterobj - a Persistent value, to link in after "after"
public static void linkBefore(goodsjpi.Persistent before,
goodsjpi.Persistent obj)
linkBefore links "obj" before "before" such that obj.next
== before.
before - a Persistent value to link object beforeobj - a Persistent value to link in.public static void unlink(goodsjpi.Persistent obj)
unlink the given object so that obj.next.prev = obj.prev
and obj.prev.next = obj.next .
obj - a Persistent value to unlink.public void removeFromCache(goodsjpi.Persistent obj)
obj - a Persistent valuepublic void removeFromCache(goodsjpi.Database db)
db - database which objects should be removed from cachepublic void insertInCache(goodsjpi.Persistent obj)
insertInCache insert object in one of two cache LRU lists
depending on its current
state. If total size of objects in this part of the cache exceeds limit
value, least recently used objects will be removed from the cache
(and from client memory) until total size of objects becomes less or
equal than limit.
obj - a Persistent valuepublic void addToTransaction(goodsjpi.Persistent obj)
obj - a Persistent valuepublic void setFreeMemoryWatermark(long watermark)
watermark - a long value
public void setCacheLimits(int l0,
int l1)
l0 - an int valuel1 - an int valuepublic final void enter()
public final void leave()
public void forgetObject(goodsjpi.Persistent obj)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||