org.atmosphere.cache
Class DefaultBroadcasterCache

java.lang.Object
  extended by org.atmosphere.cache.DefaultBroadcasterCache
All Implemented Interfaces:
BroadcasterCache

public class DefaultBroadcasterCache
extends Object
implements BroadcasterCache


Field Summary
 
Fields inherited from interface org.atmosphere.cpr.BroadcasterCache
DEFAULT
 
Constructor Summary
DefaultBroadcasterCache()
           
 
Method Summary
 CacheMessage addToCache(String broadcasterId, AtmosphereResource r, BroadcastMessage e)
          Start tracking messages associated with AtmosphereResource from the cache
 void clearCache(String broadcasterId, AtmosphereResource r, CacheMessage cache)
          Remove the previously cached message.
 void configure(AtmosphereConfig config)
          Configure the cache.
 void excludeFromCache(String broadcasterId, AtmosphereResource r)
          Allow an application to exclude, or block, an AtmosphereResource to received cached message.
 boolean includeInCache(String broadcasterId, AtmosphereResource r)
          Re-allow an AtmosphereResource to receive cached message.
 BroadcasterCache inspector(BroadcasterCacheInspector interceptor)
          Add a BroadcasterCacheInspector that will be invoked before a message gets added to the cache.
 List<Object> retrieveFromCache(String id, AtmosphereResource r)
          Retrieve messages associated with AtmosphereResource
 void start()
          Start
 void stop()
          Stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultBroadcasterCache

public DefaultBroadcasterCache()
Method Detail

start

public void start()
Description copied from interface: BroadcasterCache
Start

Specified by:
start in interface BroadcasterCache

stop

public void stop()
Description copied from interface: BroadcasterCache
Stop

Specified by:
stop in interface BroadcasterCache

configure

public void configure(AtmosphereConfig config)
Description copied from interface: BroadcasterCache
Configure the cache.

Specified by:
configure in interface BroadcasterCache

addToCache

public CacheMessage addToCache(String broadcasterId,
                               AtmosphereResource r,
                               BroadcastMessage e)
Description copied from interface: BroadcasterCache
Start tracking messages associated with AtmosphereResource from the cache

Specified by:
addToCache in interface BroadcasterCache
Parameters:
broadcasterId - The associated Broadcaster#addAtmosphereResource(AtmosphereResource).getID
r - AtmosphereResource
e - BroadcastMessage.
Returns:
The CacheMessage

retrieveFromCache

public List<Object> retrieveFromCache(String id,
                                      AtmosphereResource r)
Description copied from interface: BroadcasterCache
Retrieve messages associated with AtmosphereResource

Specified by:
retrieveFromCache in interface BroadcasterCache
Parameters:
id - The associated Broadcaster#addAtmosphereResource(AtmosphereResource).getID
r - AtmosphereResource
Returns:
a List of messages (String).

clearCache

public void clearCache(String broadcasterId,
                       AtmosphereResource r,
                       CacheMessage cache)
Description copied from interface: BroadcasterCache
Remove the previously cached message.

Specified by:
clearCache in interface BroadcasterCache
Parameters:
broadcasterId - The Broadcaster.getID()
r - an AtmosphereResource
cache - the CacheMessage

excludeFromCache

public void excludeFromCache(String broadcasterId,
                             AtmosphereResource r)
Description copied from interface: BroadcasterCache
Allow an application to exclude, or block, an AtmosphereResource to received cached message.

Specified by:
excludeFromCache in interface BroadcasterCache
Parameters:
broadcasterId - The Broadcaster.getID()
r - an AtmosphereResource

includeInCache

public boolean includeInCache(String broadcasterId,
                              AtmosphereResource r)
Description copied from interface: BroadcasterCache
Re-allow an AtmosphereResource to receive cached message.

Specified by:
includeInCache in interface BroadcasterCache
Parameters:
broadcasterId - The Broadcaster.getID()
r - an AtmosphereResource

inspector

public BroadcasterCache inspector(BroadcasterCacheInspector interceptor)
Description copied from interface: BroadcasterCache
Add a BroadcasterCacheInspector that will be invoked before a message gets added to the cache.

Specified by:
inspector in interface BroadcasterCache
Returns:
this


Copyright © 2013. All Rights Reserved.