| java.lang.Object org.sakaiproject.event.impl.NotificationCache
NotificationCache | public class NotificationCache implements Cacher,Observer(Code) | |
A Cache of objects with keys with a limited lifespan.
When the object expires, the cache calls upon a CacheRefresher to update the key's value. The update is done in a separate thread.
|
Field Summary | |
protected boolean | m_complete If true, we have all the entries that there are in the cache. | protected boolean | m_disabled If true, we are disabled. | protected Map | m_functionMap Map of notification function to Set of notifications - same objects as in m_map. | protected List | m_heldEvents The events we are holding for later processing. | protected boolean | m_holdEventProcessing If true, we are going to hold any events we see in the m_heldEvents list for later processing. | protected Map | m_map Map holding cached entries (by reference). | protected CacheRefresher | m_refresher The object that will deal with expired entries. | protected String | m_resourcePattern The string that all resources in this cache will start with. |
Method Summary | |
public synchronized void | clear() Clear all entries. | public synchronized boolean | containsKey(Object key) Test for an entry in the cache.
Parameters: key - The cache key. | public void | disable() Disable the cache. | public boolean | disabled() | public void | enable() Enable the cache. | protected void | finalize() Clean up. | public synchronized Notification | get(Object key) Get the entry associated with the key, or null if not there
Parameters: key - The cache key. | public List | getAll() Get all the non-null entries. | public List | getAll(String function) Get all the Notification entries that are watching this Event function.
Parameters: function - The function to use to select Notifications. | public String | getDescription() Return a description of the cacher. | public List | getIds() Get all the keys, eache modified to remove the resourcePattern prefix. | public List | getKeys() | public long | getSize() Return the size of the cacher - indicating how much memory in use. | public synchronized void | holdEvents() Set the cache to hold events for later processing to assure an atomic "complete" load. | public boolean | isComplete() | public synchronized void | processEvents() Restore normal event processing in the cache, and process any held events now. | public synchronized void | put(Notification payload) Cache an object. | public synchronized void | remove(Object key) Remove this entry from the cache. | public void | resetCache() Clear out as much as possible anything cached; re-sync any cache that is needed to be kept. | public void | setComplete() Set the cache to be complete, containing all possible entries. | public void | update(Observable o, Object arg) This method is called whenever the observed object is changed. |
m_complete | protected boolean m_complete(Code) | | If true, we have all the entries that there are in the cache.
|
m_disabled | protected boolean m_disabled(Code) | | If true, we are disabled.
|
m_functionMap | protected Map m_functionMap(Code) | | Map of notification function to Set of notifications - same objects as in m_map.
|
m_heldEvents | protected List m_heldEvents(Code) | | The events we are holding for later processing.
|
m_holdEventProcessing | protected boolean m_holdEventProcessing(Code) | | If true, we are going to hold any events we see in the m_heldEvents list for later processing.
|
m_map | protected Map m_map(Code) | | Map holding cached entries (by reference).
|
m_refresher | protected CacheRefresher m_refresher(Code) | | The object that will deal with expired entries.
|
m_resourcePattern | protected String m_resourcePattern(Code) | | The string that all resources in this cache will start with.
|
NotificationCache | public NotificationCache(CacheRefresher refresher, String pattern)(Code) | | Construct the Cache. Attempts to keep complete on Event notification by calling the refresher.
Parameters: refresher - The object that will handle refreshing of event notified modified or added entries. Parameters: pattern - The "startsWith()" string for all resources that may be in this cache. |
clear | public synchronized void clear()(Code) | | Clear all entries.
|
containsKey | public synchronized boolean containsKey(Object key)(Code) | | Test for an entry in the cache.
Parameters: key - The cache key. true if the key maps to an entry, false if not. |
disable | public void disable()(Code) | | Disable the cache.
|
disabled | public boolean disabled()(Code) | | Is the cache disabled?
true if the cache is disabled, false if it is enabled. |
enable | public void enable()(Code) | | Enable the cache.
|
finalize | protected void finalize()(Code) | | Clean up.
|
get | public synchronized Notification get(Object key)(Code) | | Get the entry associated with the key, or null if not there
Parameters: key - The cache key. The entry associated with the key, or null if the a null is cached, or the key is not found (Note: use containsKey() to remove this ambiguity). |
getAll | public List getAll()(Code) | | Get all the non-null entries.
all the non-null entries, or an empty list if none. |
getAll | public List getAll(String function)(Code) | | Get all the Notification entries that are watching this Event function.
Parameters: function - The function to use to select Notifications. all the Notification entries that are watching this Event function. |
getDescription | public String getDescription()(Code) | | Return a description of the cacher.
The cacher's description. |
getIds | public List getIds()(Code) | | Get all the keys, eache modified to remove the resourcePattern prefix. Note: only works with String keys.
The List of keys converted from references to ids (String). |
getKeys | public List getKeys()(Code) | | Get all the keys
The List of key values (Object). |
getSize | public long getSize()(Code) | | Return the size of the cacher - indicating how much memory in use.
The size of the cacher. |
holdEvents | public synchronized void holdEvents()(Code) | | Set the cache to hold events for later processing to assure an atomic "complete" load.
|
isComplete | public boolean isComplete()(Code) | | Are we complete?
true if we have all the possible entries cached, false if not. |
processEvents | public synchronized void processEvents()(Code) | | Restore normal event processing in the cache, and process any held events now.
|
put | public synchronized void put(Notification payload)(Code) | | Cache an object.
Parameters: key - The key with which to find the object. Parameters: payload - The object to cache. Parameters: duration - The time to cache the object (seconds). |
remove | public synchronized void remove(Object key)(Code) | | Remove this entry from the cache.
Parameters: key - The cache key. |
resetCache | public void resetCache()(Code) | | Clear out as much as possible anything cached; re-sync any cache that is needed to be kept.
|
setComplete | public void setComplete()(Code) | | Set the cache to be complete, containing all possible entries.
|
update | public void update(Observable o, Object arg)(Code) | | This method is called whenever the observed object is changed. An application calls an Observable object's notifyObservers method to have all the object's observers notified of the change. default implementation is to
cause the courier service to deliver to the interface controlled by my controller. Extensions can override.
Parameters: o - the observable object. Parameters: arg - an argument passed to the notifyObservers method. |
|
|