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.Entry
 
Nested classes/interfaces inherited from interface org.atmosphere.cpr.Broadcaster
Broadcaster.POLICY, Broadcaster.SCOPE
 
Field Summary
protected  AtmosphereServlet.AtmosphereConfig config
           
 
Fields inherited from class org.atmosphere.cpr.DefaultBroadcaster
bc, broadcasterCache, broadcastOnResume, delayedBroadcast, destroyed, messages, name, notifierFuture, resources, scope, started
 
Constructor Summary
AbstractBroadcasterProxy()
           
AbstractBroadcasterProxy(String id)
           
 
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)
           
 void configure(AtmosphereServlet.AtmosphereConfig config)
          Allow this Broadcaster to configure itself using the AtmosphereServlet.AtmosphereConfig or the ServletContext.
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, broadcastOnResume, broadcastOnResume, checkCachedAndPush, delayBroadcast, delayBroadcast, destroy, executeAsyncWrite, filter, getAtmosphereResources, getBroadcasterConfig, getID, getScope, onException, perRequestFilter, push, releaseExternalResources, removeAtmosphereResource, resumeAll, retrieveTrackedBroadcast, scheduleFixedBroadcast, scheduleFixedBroadcast, setBroadcasterConfig, setBroadcasterLifeCyclePolicy, setID, setScope, setSuspendPolicy, start, toString, trackBroadcastMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

config

protected AtmosphereServlet.AtmosphereConfig config
Constructor Detail

AbstractBroadcasterProxy

public AbstractBroadcasterProxy()

AbstractBroadcasterProxy

public AbstractBroadcasterProxy(String id)
Method Detail

configure

public void configure(AtmosphereServlet.AtmosphereConfig config)
Allow this Broadcaster to configure itself using the AtmosphereServlet.AtmosphereConfig or the ServletContext.

Parameters:
config - the AtmosphereServlet.AtmosphereConfig

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 © 2011. All Rights Reserved.