Package org.atmosphere.cache
Class DefaultBroadcasterCache
- java.lang.Object
-
- org.atmosphere.cache.DefaultBroadcasterCache
-
- All Implemented Interfaces:
BroadcasterCache,AtmosphereConfigAware
public class DefaultBroadcasterCache extends java.lang.Object implements BroadcasterCache
-
-
Field Summary
-
Fields inherited from interface org.atmosphere.cpr.BroadcasterCache
DEFAULT, NULL
-
-
Constructor Summary
Constructors Constructor Description DefaultBroadcasterCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BroadcasterCacheaddBroadcasterCacheListener(BroadcasterCacheListener l)Add aBroadcasterCacheListenerCacheMessageaddToCache(java.lang.String broadcasterId, java.lang.String uuid, BroadcastMessage message)Start tracking messages associated withAtmosphereResourcefrom the cache.BroadcasterCachecacheCandidate(java.lang.String broadcasterId, java.lang.String uuid)Add aAtmosphereResource.uuid()to the list of activeAtmosphereResourceMessage will be cached for the resource associated with the uuid.voidcleanup()Clean resources associated with this instance.BroadcasterCacheclearCache(java.lang.String broadcasterId, java.lang.String uuid, CacheMessage cache)Remove the previously cached message.voidconfigure(AtmosphereConfig config)Configure an AtmosphereFramework object.BroadcasterCacheexcludeFromCache(java.lang.String broadcasterId, AtmosphereResource r)Allow an application to exclude, or block, anAtmosphereResourceto received cached message.BroadcasterCacheinspector(BroadcasterCacheInspector interceptor)Add aBroadcasterCacheInspectorthat will be invoked before a message gets added to the cache.BroadcasterCacheremoveBroadcasterCacheListener(BroadcasterCacheListener l)Remove aBroadcasterCacheListenerjava.util.List<java.lang.Object>retrieveFromCache(java.lang.String id, java.lang.String uuid)Retrieve messages associated withAtmosphereResource.voidstart()This method is invoked when the Broadcaster is started.voidstop()This method is invoked when the Broadcaster is stopped.
-
-
-
Method Detail
-
start
public void start()
Description copied from interface:BroadcasterCacheThis method is invoked when the Broadcaster is started.- Specified by:
startin interfaceBroadcasterCache
-
stop
public void stop()
Description copied from interface:BroadcasterCacheThis method is invoked when the Broadcaster is stopped.- Specified by:
stopin interfaceBroadcasterCache
-
cleanup
public void cleanup()
Description copied from interface:BroadcasterCacheClean resources associated with this instance. This method is useful when ExecutorServices are shared and some future must be cancelled. This method will always be invoked when aBroadcastergets destroyed.- Specified by:
cleanupin interfaceBroadcasterCache
-
addToCache
public CacheMessage addToCache(java.lang.String broadcasterId, java.lang.String uuid, BroadcastMessage message)
Description copied from interface:BroadcasterCacheStart tracking messages associated withAtmosphereResourcefrom the cache.- Specified by:
addToCachein interfaceBroadcasterCache- Parameters:
broadcasterId- The associated {@link Broadcaster#addAtmosphereResource(AtmosphereResource).getID}uuid-AtmosphereResource.uuid()message-BroadcastMessage.- Returns:
- The
CacheMessage
-
retrieveFromCache
public java.util.List<java.lang.Object> retrieveFromCache(java.lang.String id, java.lang.String uuid)Description copied from interface:BroadcasterCacheRetrieve messages associated withAtmosphereResource.- Specified by:
retrieveFromCachein interfaceBroadcasterCache- Parameters:
id- The associated {@link org.atmosphere.cpr.Broadcaster#addAtmosphereResource(org.atmosphere.cpr.AtmosphereResource).getID}uuid-AtmosphereResource- Returns:
- a
Listof messages (String).
-
clearCache
public BroadcasterCache clearCache(java.lang.String broadcasterId, java.lang.String uuid, CacheMessage cache)
Description copied from interface:BroadcasterCacheRemove the previously cached message.- Specified by:
clearCachein interfaceBroadcasterCache- Parameters:
broadcasterId- TheBroadcaster.getID()uuid- anAtmosphereResource.uuid()cache- theCacheMessage
-
excludeFromCache
public BroadcasterCache excludeFromCache(java.lang.String broadcasterId, AtmosphereResource r)
Description copied from interface:BroadcasterCacheAllow an application to exclude, or block, anAtmosphereResourceto received cached message. No new message will get sent to this client except the ones already cached.- Specified by:
excludeFromCachein interfaceBroadcasterCache- Parameters:
broadcasterId- TheBroadcaster.getID()r- anAtmosphereResource- Returns:
- this
-
cacheCandidate
public BroadcasterCache cacheCandidate(java.lang.String broadcasterId, java.lang.String uuid)
Description copied from interface:BroadcasterCacheAdd aAtmosphereResource.uuid()to the list of activeAtmosphereResourceMessage will be cached for the resource associated with the uuid.- Specified by:
cacheCandidatein interfaceBroadcasterCache- Parameters:
broadcasterId- TheBroadcaster.getID()uuid- anAtmosphereResource.uuid()- Returns:
- this
-
inspector
public BroadcasterCache inspector(BroadcasterCacheInspector interceptor)
Description copied from interface:BroadcasterCacheAdd aBroadcasterCacheInspectorthat will be invoked before a message gets added to the cache.- Specified by:
inspectorin interfaceBroadcasterCache- Parameters:
interceptor- an instance ofBroadcasterCacheInspector- Returns:
- this
-
addBroadcasterCacheListener
public BroadcasterCache addBroadcasterCacheListener(BroadcasterCacheListener l)
Description copied from interface:BroadcasterCacheAdd aBroadcasterCacheListener- Specified by:
addBroadcasterCacheListenerin interfaceBroadcasterCache- Parameters:
l- aBroadcasterCacheListener- Returns:
- this
-
removeBroadcasterCacheListener
public BroadcasterCache removeBroadcasterCacheListener(BroadcasterCacheListener l)
Description copied from interface:BroadcasterCacheRemove aBroadcasterCacheListener- Specified by:
removeBroadcasterCacheListenerin interfaceBroadcasterCache- Parameters:
l- aBroadcasterCacheListener- Returns:
- this
-
configure
public void configure(AtmosphereConfig config)
Description copied from interface:AtmosphereConfigAwareConfigure an AtmosphereFramework object.- Specified by:
configurein interfaceAtmosphereConfigAware- Parameters:
config-AtmosphereConfig
-
-