|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Broadcaster<E extends AtmosphereEvent>
A Broadcaster is responsible for delivering messages to its subscribed
AtmosphereEvent, which are representing a suspended response.
AtmosphereEvent can be added using addAtmosphereEvent(E),
so when broadcast(java.lang.Object) execute,
AtmosphereHandler.onMessage(org.atmosphere.cpr.AtmosphereEvent) will
by invoked and the suspended connection will have a chance to write the
message available using AtmosphereEvent.getMessage()
A Broadcaster, by default, wil use the calling Thread to execute the
broadcast operation. To enable parallel execution, you can set an ExecutorService
which will be used to concurrently broadcast message.
| Method Summary | |
|---|---|
boolean |
addAtmosphereEvent(E event)
Add a AtmosphereEvent to the list of item to be notified when
the broadcast(java.lang.Object) is invoked. |
void |
broadcast(Object o)
Broadcast the Object to all suspended response, e.g. |
void |
broadcast(Object o,
E event)
Broadcast the Object to all suspended response, e.g. |
void |
broadcast(Object o,
Set<E> subset)
Broadcast the Object to all suspended response, e.g. |
ExecutorService |
getExecutorService()
Return the ExecutorService this Broadcaster support. |
boolean |
removeAtmosphereEvent(E event)
Remove a AtmosphereEvent from the list of item to be notified when
the broadcast(java.lang.Object) is invoked. |
void |
setExecutorService(ExecutorService executorService)
Set an ExecutorService which can be used to dispatch
AtmosphereEvent. |
| Method Detail |
|---|
void broadcast(Object o)
Object to all suspended response, e.g. invoke
AtmosphereHandler.onMessage(org.atmosphere.cpr.AtmosphereEvent) .
o - and Object to be shared.
void broadcast(Object o,
E event)
Object to all suspended response, e.g. invoke
AtmosphereHandler.onMessage(org.atmosphere.cpr.AtmosphereEvent) with an instance of AtmosphereEvent, representing
a set of AtmosphereHandler.
o - and Object to be shared.event - an AtmosphereEvent
void broadcast(Object o,
Set<E> subset)
Object to all suspended response, e.g. invoke
AtmosphereHandler.onMessage(org.atmosphere.cpr.AtmosphereEvent) with a Set of AtmosphereEvent,
representing a set of AtmosphereHandler.
o - and Object to be shared.event - an AtmosphereEventboolean addAtmosphereEvent(E event)
AtmosphereEvent to the list of item to be notified when
the broadcast(java.lang.Object) is invoked.
event - an AtmosphereEvent
boolean removeAtmosphereEvent(E event)
AtmosphereEvent from the list of item to be notified when
the broadcast(java.lang.Object) is invoked.
event - an AtmosphereEvent
void setExecutorService(ExecutorService executorService)
ExecutorService which can be used to dispatch
AtmosphereEvent. Set it to null if broadcast must be executed
using the calling thread (this is the default).
executorService - to be used when broadcasting.ExecutorService getExecutorService()
ExecutorService this Broadcaster support.
By defaul it return null, which means the calling thread is used when
invoking broadcast(java.lang.Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||