org.atmosphere.cache
Class UUIDBroadcasterCache

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

public class UUIDBroadcasterCache
extends Object
implements BroadcasterCache

An improved BroadcasterCache implementation.

Author:
Paul Khodchenkov, Jeanfrancois Arcand

Nested Class Summary
static class UUIDBroadcasterCache.CacheMessage
           
static class UUIDBroadcasterCache.ClientQueue
           
 
Nested classes/interfaces inherited from interface org.atmosphere.cpr.BroadcasterCache
BroadcasterCache.STRATEGY
 
Field Summary
protected  ScheduledExecutorService taskScheduler
           
 
Fields inherited from interface org.atmosphere.cpr.BroadcasterCache
BROADCASTER_CACHE_TRACKER
 
Constructor Summary
UUIDBroadcasterCache()
           
 
Method Summary
 Map<String,Long> activeClients()
           
 UUIDBroadcasterCache.CacheMessage addCacheCandidate(String broadcasterId, AtmosphereResource r, Object e)
          For backward compatibility with 1.0.9 and lower, use the method above.
 void addToCache(String broadcasterId, AtmosphereResource r, Object e)
          Start tracking messages associated with AtmosphereResource from the cache
 void clearCache(String broadcasterId, AtmosphereResourceImpl r, UUIDBroadcasterCache.CacheMessage message)
           
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 setExecutorService(ScheduledExecutorService reaper)
           
 void setInvalidateCacheInterval(long invalidateCacheInterval)
           
 void start()
          Start
 void stop()
          Stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

taskScheduler

protected ScheduledExecutorService taskScheduler
Constructor Detail

UUIDBroadcasterCache

public UUIDBroadcasterCache()
Method Detail

setInvalidateCacheInterval

public void setInvalidateCacheInterval(long invalidateCacheInterval)

setClientIdleTime

public void setClientIdleTime(long clientIdleTime)

setExecutorService

public void setExecutorService(ScheduledExecutorService reaper)

start

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

Specified by:
start in interface BroadcasterCache

invalidateExpiredEntries

protected void invalidateExpiredEntries()

stop

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

Specified by:
stop in interface BroadcasterCache

addToCache

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

Specified by:
addToCache in interface BroadcasterCache
r - AtmosphereResource
e - a broadcasted message.

addCacheCandidate

public UUIDBroadcasterCache.CacheMessage addCacheCandidate(String broadcasterId,
                                                           AtmosphereResource r,
                                                           Object e)
For backward compatibility with 1.0.9 and lower, use the method above.

Parameters:
broadcasterId -
r -
e -
Returns:

retrieveFromCache

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

Specified by:
retrieveFromCache in interface BroadcasterCache
r - AtmosphereResource
Returns:
a List of messages (String).

clearCache

public void clearCache(String broadcasterId,
                       AtmosphereResourceImpl r,
                       UUIDBroadcasterCache.CacheMessage message)

messages

public Map<String,UUIDBroadcasterCache.ClientQueue> messages()

activeClients

public Map<String,Long> activeClients()


Copyright © 2013. All Rights Reserved.