org.jboss.shotoku.cache
Class ShotokuResourceWatcher<K,T>
java.lang.Object
org.jboss.shotoku.cache.ShotokuCacheItem<K,T>
org.jboss.shotoku.cache.ShotokuResourceWatcher<K,T>
- Direct Known Subclasses:
- ShotokuPropertiesWatcher, ShotokuResourceWatcherSplitDescriptor
public abstract class ShotokuResourceWatcher<K,T>
- extends ShotokuCacheItem<K,T>
Extend this class if you want to store objects in the cache that
will be updated whenever any of the watched resources in a content
manager changes (a resource changes when it is added, deleted or
modified).
- Author:
- Adam Warski (adamw@aster.pl)
|
Method Summary |
protected void |
addWatchedPath(K key,
java.lang.String path)
Adds a path to the watched resources. |
protected void |
deleteWatchedPath(K key,
java.lang.String path)
|
protected void |
resetWatchedPaths(K key)
|
void |
update(K key,
T currentObject)
Called by the service periodically to update the object held. |
protected abstract void |
update(K key,
T currentObject,
java.util.Map<java.lang.String,ChangeType> changes)
Same as ShotokuCacheItem.update(String, T), but is called only when
some of the watched resources change, not on each call of update by
the service. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ShotokuResourceWatcher
public ShotokuResourceWatcher(long interval)
ShotokuResourceWatcher
public ShotokuResourceWatcher()
addWatchedPath
protected void addWatchedPath(K key,
java.lang.String path)
- Adds a path to the watched resources.
- Parameters:
key - path -
deleteWatchedPath
protected void deleteWatchedPath(K key,
java.lang.String path)
resetWatchedPaths
protected void resetWatchedPaths(K key)
update
public void update(K key,
T currentObject)
- Description copied from class:
ShotokuCacheItem
- Called by the service periodically to update the object held.
If the object in the cache should be changed, the implementing
method must call put(key, newObject).
- Specified by:
update in class ShotokuCacheItem<K,T>
- Parameters:
key - Key of the object to update.currentObject - Current value held in the cache.
update
protected abstract void update(K key,
T currentObject,
java.util.Map<java.lang.String,ChangeType> changes)
- Same as ShotokuCacheItem.update(String, T), but is called only when
some of the watched resources change, not on each call of update by
the service. If the object in the cache should be changed, the
implementing method must call put(key, newObject).
- Parameters:
key - Key of the object to update.currentObject - Current value held in the cache.changes - A map of descripiton of changes that occured since last
update.
Copyright © -2006 . All Rights Reserved.