public class SimpleBroadcaster extends DefaultBroadcaster
Broadcaster
implementation that use the calling thread when broadcasting events.DefaultBroadcaster.AsyncWriteToken, DefaultBroadcaster.WriteQueue
Broadcaster.POLICY, Broadcaster.SCOPE
asyncWriteFuture, bc, broadcasterListeners, broadcastOnResume, CACHED, candidateForPoolable, config, delayedBroadcast, destroyed, dispatchThread, initialized, lifeCycleListeners, messages, name, notifierFuture, POLLING_DEFAULT, resources, scope, sharedListeners, started, uniqueWriteQueue, uri, usingTokenIdForAttribute, waitTime, writeQueues, writeTimeoutInSecond
ROOT_MASTER
Constructor and Description |
---|
SimpleBroadcaster() |
Modifier and Type | Method and Description |
---|---|
Future<Object> |
broadcast(Object msg)
Broadcast the
Object to all suspended responses, eg. |
Future<Object> |
broadcast(Object msg,
AtmosphereResource r)
Broadcast the
Object to all suspended responses, eg. |
Future<Object> |
broadcast(Object msg,
Set<AtmosphereResource> subset)
Broadcast the
Object to all suspended response, eg. |
protected BroadcasterConfig |
createBroadcasterConfig(AtmosphereConfig config)
Create
BroadcasterConfig . |
Broadcaster |
initialize(String id,
AtmosphereConfig config) |
protected void |
prepareInvokeOnStateChange(AtmosphereResource r,
AtmosphereResourceEvent e) |
protected void |
queueWriteIO(AtmosphereResource r,
Deliver deliver,
AtomicInteger count) |
void |
setBroadcasterConfig(BroadcasterConfig bc)
Set the
BroadcasterConfig instance. |
protected void |
start() |
addAtmosphereResource, addBroadcasterLifeCyclePolicyListener, addBroadcasterListener, awaitAndBroadcast, broadcasterListeners, broadcastOnResume, broadcastOnResume, cacheAndSuspend, cacheLostMessage, cacheLostMessage, cacheLostMessage, cacheMessageOnIOException, checkCachedAndPush, currentLifecycleTask, currentLifecycleTask, delayBroadcast, delayBroadcast, deliverPush, destroy, dispatchMessages, endBroadcast, entryDone, executeAsyncWrite, executeBlockingWrite, filter, futureDone, getAsyncWriteHandler, getAtmosphereResources, getBroadcasterConfig, getBroadcasterLifeCyclePolicy, getBroadcastHandler, getID, getScope, initialize, invokeOnStateChange, isDestroyed, killReactiveThreads, lifecycleHandler, lifecycleHandler, lifeCycleListeners, lifeCyclePolicy, messages, notifyAndAdd, notifyBroadcastListener, notifyOnAddAtmosphereResourceListener, notifyOnMessage, notifyOnRemoveAtmosphereResourceListener, onException, onException, outOfOrderBroadcastSupported, perRequestFilter, policy, push, reactiveThreadsCount, recentActivity, releaseExternalResources, removeAtmosphereResource, removeAtmosphereResource, removeBroadcasterLifeCyclePolicyListener, removeBroadcasterListener, rename, resumeAll, retrieveTrackedBroadcast, scheduleFixedBroadcast, scheduleFixedBroadcast, setBroadcasterLifeCyclePolicy, setID, setScope, setSuspendPolicy, spawnReactor, toString, writeQueues
public Broadcaster initialize(String id, AtmosphereConfig config)
initialize
in class DefaultBroadcaster
protected BroadcasterConfig createBroadcasterConfig(AtmosphereConfig config)
DefaultBroadcaster
BroadcasterConfig
.createBroadcasterConfig
in class DefaultBroadcaster
config
- the AtmosphereConfig
BroadcasterConfig
protected void start()
start
in class DefaultBroadcaster
public void setBroadcasterConfig(BroadcasterConfig bc)
Broadcaster
BroadcasterConfig
instance.setBroadcasterConfig
in interface Broadcaster
setBroadcasterConfig
in class DefaultBroadcaster
bc
- Configuration to be set.public Future<Object> broadcast(Object msg)
Broadcaster
Object
to all suspended responses, eg. invoke AtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent)
.broadcast
in interface Broadcaster
broadcast
in class DefaultBroadcaster
msg
- the Object
to be broadcastedFuture
that can be used to synchronize using the Future.get()
public Future<Object> broadcast(Object msg, AtmosphereResource r)
Broadcaster
Object
to all suspended responses, eg. invoke
AtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent)
with an instance of AtmosphereResource
, representing
a single suspended response.broadcast
in interface Broadcaster
broadcast
in class DefaultBroadcaster
msg
- the Object
to be broadcastedr
- an AtmosphereResource
Future
that can be used to synchronize using the Future.get()
public Future<Object> broadcast(Object msg, Set<AtmosphereResource> subset)
Broadcaster
Object
to all suspended response, eg. invoke
AtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent)
with a Set
of AtmosphereResource
,
representing a set of AtmosphereHandler
.broadcast
in interface Broadcaster
broadcast
in class DefaultBroadcaster
msg
- the Object
to be broadcastedsubset
- a Set of AtmosphereResource
Future
that can be used to synchronize using the Future.get()
protected void prepareInvokeOnStateChange(AtmosphereResource r, AtmosphereResourceEvent e)
prepareInvokeOnStateChange
in class DefaultBroadcaster
protected void queueWriteIO(AtmosphereResource r, Deliver deliver, AtomicInteger count) throws InterruptedException
queueWriteIO
in class DefaultBroadcaster
InterruptedException
Copyright © 2016. All rights reserved.