|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgoodsjpi.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(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(Persistent obj)
Place object in forgotten list |
static CacheManager |
getCacheManager()
getCacheManager the current manager. |
void |
insertInCache(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(Persistent after,
Persistent obj)
Link the given object after the other. |
static void |
linkBefore(Persistent before,
Persistent obj)
linkBefore links "obj" before "before" such that obj.next
== before. |
void |
removeFromCache(Database db)
Remove from cache all objects from the specified database |
void |
removeFromCache(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(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 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 detatchpublic static void linkAfter(Persistent after, Persistent obj)
after
- a Persistent
value, to link obj afterobj
- a Persistent
value, to link in after "after"public static void linkBefore(Persistent before, 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(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(Persistent obj)
obj
- a Persistent
valuepublic void removeFromCache(Database db)
db
- database which objects should be removed from cachepublic void insertInCache(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(Persistent obj)
obj
- a Persistent
valuepublic void setFreeMemoryWatermark(long watermark)
watermark
- a long
valuepublic void setCacheLimits(int l0, int l1)
l0
- an int
valuel1
- an int
valuepublic final void enter()
public final void leave()
public void forgetObject(Persistent obj)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |