|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.atmosphere.cache.AbstractBroadcasterCache
public abstract class AbstractBroadcasterCache
Abstract BroadcasterCache which is used to implement headers, query parameters or
session based caching.
| Field Summary | |
|---|---|
protected List<Object> |
emptyList
|
protected List<BroadcasterCacheInspector> |
inspectors
|
protected long |
invalidateCacheInterval
|
protected boolean |
isShared
|
protected long |
maxCacheTime
|
protected List<CacheMessage> |
messages
|
protected Set<String> |
messagesIds
|
protected ReadWriteLock |
readWriteLock
|
protected ScheduledExecutorService |
reaper
|
protected ScheduledFuture |
scheduledFuture
|
| Fields inherited from interface org.atmosphere.cpr.BroadcasterCache |
|---|
DEFAULT |
| Constructor Summary | |
|---|---|
AbstractBroadcasterCache()
|
|
| Method Summary | |
|---|---|
void |
cleanup()
Clean resources associated with this instance. |
void |
clearCache(String broadcasterId,
AtmosphereResource r,
CacheMessage cache)
Remove the previously cached message. |
void |
configure(BroadcasterConfig config)
Configure the cache. |
void |
excludeFromCache(String broadcasterId,
AtmosphereResource r)
Allow an application to exclude, or block, an AtmosphereResource to received cached message. |
protected List<Object> |
get(long cacheHeaderTime)
|
protected boolean |
inspect(BroadcastMessage m)
|
BroadcasterCache |
inspector(BroadcasterCacheInspector b)
Add a BroadcasterCacheInspector that will be invoked before a message gets added to the cache. |
protected CacheMessage |
put(BroadcastMessage message,
Long now)
|
AbstractBroadcasterCache |
setInvalidateCacheInterval(long invalidateCacheInterval)
Set the delay between cache purges. |
AbstractBroadcasterCache |
setMaxCacheTime(long maxCacheTime)
Set the maximum time a message stays alive in the cache. |
void |
start()
This method is invoked when the Broadcaster is started. |
void |
stop()
This method is invoked when the Broadcaster is stopped. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.atmosphere.cpr.BroadcasterCache |
|---|
addToCache, retrieveFromCache |
| Field Detail |
|---|
protected final List<CacheMessage> messages
protected final Set<String> messagesIds
protected final ReadWriteLock readWriteLock
protected ScheduledFuture scheduledFuture
protected long maxCacheTime
protected long invalidateCacheInterval
protected ScheduledExecutorService reaper
protected boolean isShared
protected final List<BroadcasterCacheInspector> inspectors
protected final List<Object> emptyList
| Constructor Detail |
|---|
public AbstractBroadcasterCache()
| Method Detail |
|---|
public void start()
BroadcasterCache
start in interface BroadcasterCachepublic void cleanup()
BroadcasterCacheBroadcaster gets destroyed.
cleanup in interface BroadcasterCachepublic void stop()
BroadcasterCache
stop in interface BroadcasterCache
protected CacheMessage put(BroadcastMessage message,
Long now)
protected List<Object> get(long cacheHeaderTime)
public AbstractBroadcasterCache setInvalidateCacheInterval(long invalidateCacheInterval)
invalidateCacheInterval - the purge interval in milliseconds
public AbstractBroadcasterCache setMaxCacheTime(long maxCacheTime)
maxCacheTime - the maximum time in milliseconds.
public BroadcasterCache inspector(BroadcasterCacheInspector b)
BroadcasterCacheBroadcasterCacheInspector that will be invoked before a message gets added to the cache.
inspector in interface BroadcasterCacheb - an instance of BroadcasterCacheInspector
protected boolean inspect(BroadcastMessage m)
public void configure(BroadcasterConfig config)
BroadcasterCache
configure in interface BroadcasterCacheconfig - a BroadcasterConfig
public void clearCache(String broadcasterId,
AtmosphereResource r,
CacheMessage cache)
BroadcasterCache
clearCache in interface BroadcasterCachebroadcasterId - The Broadcaster.getID()r - an AtmosphereResourcecache - the CacheMessage
public void excludeFromCache(String broadcasterId,
AtmosphereResource r)
BroadcasterCacheAtmosphereResource to received cached message.
No new message will get sent to this client except the ones already cached.
excludeFromCache in interface BroadcasterCachebroadcasterId - The Broadcaster.getID()r - an AtmosphereResource
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||