Package org.atmosphere.util
Class SimpleBroadcaster
java.lang.Object
org.atmosphere.cpr.DefaultBroadcaster
org.atmosphere.util.SimpleBroadcaster
- All Implemented Interfaces:
Broadcaster
Simple
Broadcaster implementation that use the calling thread when broadcasting events.- Author:
- Jeanfrancois Arcand
-
Nested Class Summary
Nested classes/interfaces inherited from class org.atmosphere.cpr.DefaultBroadcaster
DefaultBroadcaster.AsyncWriteToken, DefaultBroadcaster.WriteQueueNested classes/interfaces inherited from interface org.atmosphere.cpr.Broadcaster
Broadcaster.POLICY, Broadcaster.SCOPE -
Field Summary
Fields inherited from class org.atmosphere.cpr.DefaultBroadcaster
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, writeTimeoutInSecondFields inherited from interface org.atmosphere.cpr.Broadcaster
ROOT_MASTER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBroadcast theObjectto all suspended responses, eg.broadcast(Object msg, Set<AtmosphereResource> subset) Broadcast theObjectto all suspended response, eg.broadcast(Object msg, AtmosphereResource r) Broadcast theObjectto all suspended responses, eg.protected BroadcasterConfigCreateBroadcasterConfig.initialize(String id, AtmosphereConfig config) protected voidprotected voidqueueWriteIO(AtmosphereResource r, Deliver deliver, AtomicInteger count) voidSet theBroadcasterConfiginstance.protected voidstart()Methods inherited from class org.atmosphere.cpr.DefaultBroadcaster
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
-
Constructor Details
-
SimpleBroadcaster
public SimpleBroadcaster()
-
-
Method Details
-
initialize
- Overrides:
initializein classDefaultBroadcaster
-
createBroadcasterConfig
Description copied from class:DefaultBroadcasterCreateBroadcasterConfig.- Overrides:
createBroadcasterConfigin classDefaultBroadcaster- Parameters:
config- theAtmosphereConfig- Returns:
- an instance of
BroadcasterConfig
-
start
protected void start()- Overrides:
startin classDefaultBroadcaster
-
setBroadcasterConfig
Description copied from interface:BroadcasterSet theBroadcasterConfiginstance.- Specified by:
setBroadcasterConfigin interfaceBroadcaster- Overrides:
setBroadcasterConfigin classDefaultBroadcaster- Parameters:
bc- Configuration to be set.
-
broadcast
Description copied from interface:BroadcasterBroadcast theObjectto all suspended responses, eg. invokeAtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent).- Specified by:
broadcastin interfaceBroadcaster- Overrides:
broadcastin classDefaultBroadcaster- Parameters:
msg- theObjectto be broadcasted- Returns:
- a
Futurethat can be used to synchronize using theFuture.get()
-
broadcast
Description copied from interface:BroadcasterBroadcast theObjectto all suspended responses, eg. invokeAtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent)with an instance ofAtmosphereResource, representing a single suspended response.- Specified by:
broadcastin interfaceBroadcaster- Overrides:
broadcastin classDefaultBroadcaster- Parameters:
msg- theObjectto be broadcastedr- anAtmosphereResource- Returns:
- a
Futurethat can be used to synchronize using theFuture.get()
-
broadcast
Description copied from interface:BroadcasterBroadcast theObjectto all suspended response, eg. invokeAtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent)with aSetofAtmosphereResource, representing a set ofAtmosphereHandler.- Specified by:
broadcastin interfaceBroadcaster- Overrides:
broadcastin classDefaultBroadcaster- Parameters:
msg- theObjectto be broadcastedsubset- a Set ofAtmosphereResource- Returns:
- a
Futurethat can be used to synchronize using theFuture.get()
-
prepareInvokeOnStateChange
- Overrides:
prepareInvokeOnStateChangein classDefaultBroadcaster
-
queueWriteIO
protected void queueWriteIO(AtmosphereResource r, Deliver deliver, AtomicInteger count) throws InterruptedException - Overrides:
queueWriteIOin classDefaultBroadcaster- Throws:
InterruptedException
-