|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.atmosphere.cache.UUIDBroadcasterCache
public class UUIDBroadcasterCache
An improved BroadcasterCache implementation that is based on the unique identifier (UUID) that all
AtmosphereResources have.
| Nested Class Summary | |
|---|---|
static class |
UUIDBroadcasterCache.ClientQueue
|
| Field Summary | |
|---|---|
protected List<Object> |
emptyList
|
protected List<BroadcasterCacheInspector> |
inspectors
|
protected ScheduledExecutorService |
taskScheduler
|
| Fields inherited from interface org.atmosphere.cpr.BroadcasterCache |
|---|
DEFAULT |
| Constructor Summary | |
|---|---|
UUIDBroadcasterCache()
|
|
| Method Summary | |
|---|---|
Map<String,Long> |
activeClients()
|
CacheMessage |
addToCache(String broadcasterId,
AtmosphereResource r,
BroadcastMessage message)
Start tracking messages associated with AtmosphereResource from the cache. |
void |
cleanup()
Clean resources associated with this instance. |
void |
clearCache(String broadcasterId,
AtmosphereResource r,
CacheMessage message)
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 boolean |
inspect(BroadcastMessage m)
|
BroadcasterCache |
inspector(BroadcasterCacheInspector b)
Add a BroadcasterCacheInspector that will be invoked before a message gets added to the cache. |
protected void |
invalidateExpiredEntries()
|
Map<String,UUIDBroadcasterCache.ClientQueue> |
messages()
|
List<Object> |
retrieveFromCache(String broadcasterId,
AtmosphereResource r)
Retrieve messages associated with AtmosphereResource. |
void |
setClientIdleTime(long clientIdleTime)
|
void |
setInvalidateCacheInterval(long invalidateCacheInterval)
|
void |
start()
This method is invoked when the Broadcaster is started. |
void |
stop()
This method is invoked when the Broadcaster is stopped. |
String |
toString()
|
protected String |
uuid(AtmosphereResource r)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final List<BroadcasterCacheInspector> inspectors
protected ScheduledExecutorService taskScheduler
protected final List<Object> emptyList
| Constructor Detail |
|---|
public UUIDBroadcasterCache()
| Method Detail |
|---|
public void configure(BroadcasterConfig config)
BroadcasterCache
configure in interface BroadcasterCacheconfig - a BroadcasterConfigpublic void start()
BroadcasterCache
start in interface BroadcasterCachepublic void stop()
BroadcasterCache
stop in interface BroadcasterCachepublic void cleanup()
BroadcasterCacheBroadcaster gets destroyed.
cleanup in interface BroadcasterCache
public CacheMessage addToCache(String broadcasterId,
AtmosphereResource r,
BroadcastMessage message)
BroadcasterCacheAtmosphereResource from the cache.
addToCache in interface BroadcasterCachebroadcasterId - The associated Broadcaster#addAtmosphereResource(AtmosphereResource).getIDr - AtmosphereResourcemessage - BroadcastMessage.
CacheMessage
public List<Object> retrieveFromCache(String broadcasterId,
AtmosphereResource r)
BroadcasterCacheAtmosphereResource.
retrieveFromCache in interface BroadcasterCachebroadcasterId - The associated Broadcaster#addAtmosphereResource(AtmosphereResource).getIDr - AtmosphereResource
List of messages (String).
public void clearCache(String broadcasterId,
AtmosphereResource r,
CacheMessage message)
BroadcasterCache
clearCache in interface BroadcasterCachebroadcasterId - The Broadcaster.getID()r - an AtmosphereResourcemessage - the CacheMessagepublic 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 String uuid(AtmosphereResource r)
public Map<String,UUIDBroadcasterCache.ClientQueue> messages()
public Map<String,Long> activeClients()
protected boolean inspect(BroadcastMessage m)
public void setInvalidateCacheInterval(long invalidateCacheInterval)
public void setClientIdleTime(long clientIdleTime)
protected void invalidateExpiredEntries()
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 AtmosphereResourcepublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||