|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.atmosphere.cpr.DefaultBroadcaster
public class DefaultBroadcaster
Broadcaster implementation.
Broadcast messages to suspended reponse using the caller's Thread.
This basic Broadcaster isn't using any ExecutorService to
broadcast messages, so it is single threaded.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.atmosphere.cpr.Broadcaster |
|---|
Broadcaster.SCOPE |
| Constructor Summary | |
|---|---|
DefaultBroadcaster()
|
|
| Method Summary | |
|---|---|
AtmosphereResource |
addAtmosphereResource(AtmosphereResource r)
Add a AtmosphereResource to the list of item to be notified when
the Broadcaster.broadcast(java.lang.Object) is invoked. |
protected ConcurrentLinkedQueue<AtmosphereResource> |
atmosphereResources()
Return the list of AtmosphereResource registered with this Broadcaster |
BroadcasterFuture<Object> |
broadcast(Object msg)
Broadcast the Object to all suspended response, e.g. |
BroadcasterFuture<Object> |
broadcast(Object msg,
AtmosphereResource r)
Broadcast the Object to all suspended response, e.g. |
BroadcasterFuture<Object> |
broadcast(Object msg,
Set<AtmosphereResource> subset)
Broadcast the Object to all suspended response, e.g. |
Future<Object> |
delayBroadcast(Object o)
Delay the broadcast operation. |
Future<Object> |
delayBroadcast(Object o,
long delay,
TimeUnit t)
Delay the broadcast operation. |
void |
destroy()
Destroy this instance and shutdown it's associated ExecutorServices |
Iterator<AtmosphereResource> |
getAtmosphereResources()
Return an Iterator AtmosphereResource |
BroadcasterConfig |
getBroadcasterConfig()
Return the current BroadcasterConfig |
String |
getName()
Return the name of this Broadcaster |
Broadcaster.SCOPE |
getScope()
Retunr the Broadcaster#SCOPE |
AtmosphereResource |
removeAtmosphereResource(AtmosphereResource r)
Remove a AtmosphereResource from the list of item to be notified when
the Broadcaster.broadcast(java.lang.Object) is invoked. |
Future<?> |
scheduleFixedBroadcast(Object o,
long period,
TimeUnit t)
Broadcast periodically. |
void |
setBroadcasterConfig(BroadcasterConfig bc)
Set the BroadcasterConfig instance. |
void |
setName(String name)
Set the name of this Broadcaster |
void |
setScope(Broadcaster.SCOPE scope)
Set the scope. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultBroadcaster()
| Method Detail |
|---|
public void destroy()
ExecutorServices
destroy in interface Broadcasterpublic Iterator<AtmosphereResource> getAtmosphereResources()
AtmosphereResource
getAtmosphereResources in interface Broadcasterpublic void setScope(Broadcaster.SCOPE scope)
setScope in interface Broadcasterpublic Broadcaster.SCOPE getScope()
Broadcaster#SCOPE
getScope in interface BroadcasterBroadcaster#SCOPEpublic void setName(String name)
Broadcaster
setName in interface Broadcastername - of this Broadcasterpublic String getName()
Broadcaster
getName in interface BroadcasterBroadcasterpublic BroadcasterFuture<Object> broadcast(Object msg)
Object to all suspended response, e.g. invoke
AtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent) .
broadcast in interface Broadcastermsg - and Object to be broadcasted.
Future that can be used to synchronize using the Future.get()
public BroadcasterFuture<Object> broadcast(Object msg,
AtmosphereResource r)
Object to all suspended response, e.g. invoke
AtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent) with an instance of AtmosphereResource, representing
a single suspended response..
broadcast in interface Broadcastermsg - and Object to be broadcasted.r - an AtmosphereResource
Future that can be used to synchronize using the Future.get()
public BroadcasterFuture<Object> broadcast(Object msg,
Set<AtmosphereResource> subset)
Object to all suspended response, e.g. invoke
AtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent) with a Set of AtmosphereResource,
representing a set of AtmosphereHandler.
broadcast in interface Broadcastermsg - and Object to be broadcasted.
Future that can be used to synchronize using the Future.get()public AtmosphereResource addAtmosphereResource(AtmosphereResource r)
AtmosphereResource to the list of item to be notified when
the Broadcaster.broadcast(java.lang.Object) is invoked.
addAtmosphereResource in interface Broadcasterr - an AtmosphereResource
AtmosphereResource if added, or null if it was already there.public AtmosphereResource removeAtmosphereResource(AtmosphereResource r)
AtmosphereResource from the list of item to be notified when
the Broadcaster.broadcast(java.lang.Object) is invoked.
removeAtmosphereResource in interface Broadcasterr - an AtmosphereResource
AtmosphereResource if removed, or null if it was not.protected ConcurrentLinkedQueue<AtmosphereResource> atmosphereResources()
public void setBroadcasterConfig(BroadcasterConfig bc)
BroadcasterConfig instance.
setBroadcasterConfig in interface Broadcasterbf - public BroadcasterConfig getBroadcasterConfig()
BroadcasterConfig
getBroadcasterConfig in interface BroadcasterBroadcasterConfigpublic Future<Object> delayBroadcast(Object o)
Object will be broadcasted
when the first Broadcaster.broadcast(java.lang.Object)
is invoked.
delayBroadcast in interface Broadcastero - and Object to be broadcasted.
Future that can be used to synchronize using the Future.get()
public Future<Object> delayBroadcast(Object o,
long delay,
TimeUnit t)
Object will be broadcasted once the
specified delay expires. If the TimeUnit is set null, the
Object will be broadcasted when the first Broadcaster.broadcast(java.lang.Object)
is invoked.
delayBroadcast in interface Broadcastero - and Object to be broadcasted.t - a TimeUnit
Future that can be used to synchronize using the Future.get()
public Future<?> scheduleFixedBroadcast(Object o,
long period,
TimeUnit t)
Object will be broadcasted after every period
specified time frame expires. If the TimeUnit is set null, the
Object will be broadcasted when the first Broadcaster.broadcast(java.lang.Object)
is invoked.
scheduleFixedBroadcast in interface Broadcastero - and Object to be broadcasted.t - a TimeUnit
Future that can be used to synchronize using the Future.get()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||