org.atmosphere.cache
Class SessionBroadcasterCache

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

public class SessionBroadcasterCache
extends AbstractBroadcasterCache

Simple HttpSession based BroadcasterCache By default, message will be cached for 5 minutes. You can change the value by calling AbstractBroadcasterCache.setMaxCachedinMs(int)

Author:
Jeanfrancois Arcand

Nested Class Summary
 
Nested classes/interfaces inherited from class org.atmosphere.cache.AbstractBroadcasterCache
AbstractBroadcasterCache.CachedMessage
 
Nested classes/interfaces inherited from interface org.atmosphere.cpr.BroadcasterCache
BroadcasterCache.STRATEGY
 
Field Summary
 
Fields inherited from class org.atmosphere.cache.AbstractBroadcasterCache
maxCachedinMs, queue, reaper, scheduledFuture
 
Fields inherited from interface org.atmosphere.cpr.BroadcasterCache
BROADCASTER_CACHE_TRACKER
 
Constructor Summary
SessionBroadcasterCache()
           
 
Method Summary
 void cache(String id, AtmosphereResource r, AbstractBroadcasterCache.CachedMessage cm)
          Cache the last message broadcasted.
 AbstractBroadcasterCache.CachedMessage retrieveLastMessage(String id, AtmosphereResource r)
          Return the last message broadcasted to the AtmosphereResource.
 
Methods inherited from class org.atmosphere.cache.AbstractBroadcasterCache
addToCache, getMaxCachedinMs, getQueueDepth, retrieveFromCache, setExecutorService, setMaxCachedinMs, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionBroadcasterCache

public SessionBroadcasterCache()
Method Detail

cache

public void cache(String id,
                  AtmosphereResource r,
                  AbstractBroadcasterCache.CachedMessage cm)
Cache the last message broadcasted.

Specified by:
cache in class AbstractBroadcasterCache
r - AtmosphereResource.
cm - AbstractBroadcasterCache.CachedMessage

retrieveLastMessage

public AbstractBroadcasterCache.CachedMessage retrieveLastMessage(String id,
                                                                  AtmosphereResource r)
Return the last message broadcasted to the AtmosphereResource.

Specified by:
retrieveLastMessage in class AbstractBroadcasterCache
r - AtmosphereResource.
Returns:
a AbstractBroadcasterCache.CachedMessage, or null if not matched.


Copyright © 2013. All Rights Reserved.