org.atmosphere.util
Class AbstractBroadcasterProxy

java.lang.Object
  extended by org.atmosphere.cpr.DefaultBroadcaster
      extended by org.atmosphere.util.AbstractBroadcasterProxy
All Implemented Interfaces:
Broadcaster

public abstract class AbstractBroadcasterProxy
extends DefaultBroadcaster

Abstract Broadcaster that delegates the internal processing to a proxy.

Author:
Jeanfrancois Arcand

Nested Class Summary
 
Nested classes/interfaces inherited from class org.atmosphere.cpr.DefaultBroadcaster
DefaultBroadcaster.AsyncWriteToken, DefaultBroadcaster.Entry
 
Nested classes/interfaces inherited from interface org.atmosphere.cpr.Broadcaster
Broadcaster.POLICY, Broadcaster.SCOPE
 
Field Summary
 
Fields inherited from class org.atmosphere.cpr.DefaultBroadcaster
ASYNC_TOKEN, asyncWriteFuture, asyncWriteQueue, bc, broadcasterListeners, broadcastOnResume, CACHED, cacheStrategy, config, delayedBroadcast, destroyed, lifeCycleListeners, messages, name, notifierFuture, resources, scope, started, uri
 
Constructor Summary
AbstractBroadcasterProxy(String id, URI uri, AtmosphereConfig config)
           
 
Method Summary
protected  void broadcast(AtmosphereResource r, AtmosphereResourceEvent e)
          
<T> Future<T>
broadcast(T msg)
          Broadcast the Object to all suspended response, e.g.
<T> Future<T>
broadcast(T msg, AtmosphereResource r)
          Broadcast the Object to all suspended response, e.g.
<T> Future<T>
broadcast(T msg, Set<AtmosphereResource> subset)
          Broadcast the Object to all suspended response, e.g.
protected  void broadcastReceivedMessage(Object message)
           
protected  Runnable getBroadcastHandler()
          
abstract  void incomingBroadcast()
          Implement this method to broadcast message received from an external source like JGroups, Redis, etc.
abstract  void outgoingBroadcast(Object message)
          Implement this method to broadcast message to external source like JGroups, Redis, etc.
protected  void reconfigure()
           
 
Methods inherited from class org.atmosphere.cpr.DefaultBroadcaster
addAtmosphereResource, addBroadcasterLifeCyclePolicyListener, addBroadcasterListener, awaitAndBroadcast, broadcastOnResume, broadcastOnResume, cacheLostMessage, cacheLostMessage, checkCachedAndPush, createBroadcasterConfig, delayBroadcast, delayBroadcast, deliverPush, destroy, entryDone, executeAsyncWrite, filter, futureDone, getAsyncWriteHandler, getAtmosphereResources, getBroadcasterConfig, getID, getScope, isDestroyed, notifyOnPostCreate, onException, onException, perRequestFilter, push, queueWriteIO, releaseExternalResources, removeAtmosphereResource, removeAtmosphereResource, removeBroadcasterLifeCyclePolicyListener, removeBroadcasterListener, resumeAll, retrieveTrackedBroadcast, scheduleFixedBroadcast, scheduleFixedBroadcast, setBroadcasterConfig, setBroadcasterLifeCyclePolicy, setID, setScope, setSuspendPolicy, spawnReactor, start, toString, trackBroadcastMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractBroadcasterProxy

public AbstractBroadcasterProxy(String id,
                                URI uri,
                                AtmosphereConfig config)
Method Detail

incomingBroadcast

public abstract void incomingBroadcast()
Implement this method to broadcast message received from an external source like JGroups, Redis, etc.


outgoingBroadcast

public abstract void outgoingBroadcast(Object message)
Implement this method to broadcast message to external source like JGroups, Redis, etc.

Parameters:
message - outgoing message

getBroadcastHandler

protected Runnable getBroadcastHandler()

Overrides:
getBroadcastHandler in class DefaultBroadcaster

reconfigure

protected void reconfigure()

broadcast

protected void broadcast(AtmosphereResource r,
                         AtmosphereResourceEvent e)

Overrides:
broadcast in class DefaultBroadcaster

broadcastReceivedMessage

protected void broadcastReceivedMessage(Object message)

broadcast

public <T> Future<T> broadcast(T msg)
Broadcast the Object to all suspended response, e.g. invoke AtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent).

Specified by:
broadcast in interface Broadcaster
Overrides:
broadcast in class DefaultBroadcaster
Parameters:
msg - and Object to be broadcasted.
Returns:
a Future that can be used to synchronize using the Future.get()

broadcast

public <T> Future<T> broadcast(T msg,
                               AtmosphereResource r)
Broadcast the Object to all suspended response, e.g. invoke AtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent) with an instance of AtmosphereResource, representing a single suspended response..

Specified by:
broadcast in interface Broadcaster
Overrides:
broadcast in class DefaultBroadcaster
Parameters:
msg - and Object to be broadcasted.
r - an AtmosphereResource
Returns:
a Future that can be used to synchronize using the Future.get()

broadcast

public <T> Future<T> broadcast(T msg,
                               Set<AtmosphereResource> subset)
Broadcast the Object to all suspended response, e.g. invoke AtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent) with a Set of AtmosphereResource, representing a set of AtmosphereHandler.

Specified by:
broadcast in interface Broadcaster
Overrides:
broadcast in class DefaultBroadcaster
Parameters:
msg - and Object to be broadcasted.
subset - a Set of AtmosphereResource
Returns:
a Future that can be used to synchronize using the Future.get()


Copyright © 2012. All Rights Reserved.