|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opendoors.cache.immutable.ChangeControl
Default behavior for managing the mutable and immutable cache as implemented by CacheImpl.
Advanced implementations of the Immutable/Mutable strategy may elect to subclass this class and provide fine grained change control for a specific type of cache.
For example a cluster of file caches would possibly require a change control manager which would sweep from time to time a disk volume and matching files in the cache which were out of date would be replaced in the cache. This kind of functionality can be performed as well by a cache manager wrapping itself around the cache interface.
This class delegates observability of the cache to an instance of PostponeObservable. In this manner, updates to the immutable cache are postponed until a sufficient period of idle activity has elapsed before changes are propagate to the immutable image.
PostponeObservable
,
Cache
,
UpdateableCache
Field Summary | |
protected java.lang.Object |
actionMutex
The synch mutex. |
protected CacheImpl |
cache
The actual cache under management. |
protected PostponeObservable |
observable
The thread delegate for managing changes. |
Constructor Summary | |
ChangeControl()
The default constructor which does nothing. |
Method Summary | |
protected java.lang.Object |
setCacheImpl(CacheImpl cache,
int refreshRate)
Sets up the cache for change control: the cache, the refresh rate and returns the mutex. |
void |
update(java.util.Observable o,
java.lang.Object arg)
Call back for changes pending to be implemented. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected CacheImpl cache
protected PostponeObservable observable
protected java.lang.Object actionMutex
Constructor Detail |
public ChangeControl()
Method Detail |
protected java.lang.Object setCacheImpl(CacheImpl cache, int refreshRate)
cache
- The cache to manage.refreshRate
- How often in millis to refresh the cache.public void update(java.util.Observable o, java.lang.Object arg)
Cache has been idle for at least n seconds.
This routine implements the generational update such that the immutable becomes identical now to the most current image in the mutable instance.
update
in interface java.util.Observer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |