public class BroadcasterConfig
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
BroadcasterConfig.FilterManipulator
Manipulate the message before and after they are getting filtered by
BroadcastFilter |
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.ConcurrentLinkedQueue<BroadcastFilter> |
filters |
protected java.util.concurrent.ConcurrentLinkedQueue<PerRequestBroadcastFilter> |
perRequestFilters |
| Constructor and Description |
|---|
BroadcasterConfig(java.util.concurrent.ExecutorService executorService,
java.util.concurrent.ExecutorService asyncWriteService,
java.util.concurrent.ScheduledExecutorService scheduler,
AtmosphereConfig config,
java.lang.String broadcasterId)
Create a new BroadcasterConfig.
|
BroadcasterConfig(java.util.List<java.lang.String> broadcastFilters,
AtmosphereConfig config,
boolean handleExecutors,
java.lang.String broadcasterId)
Create a new BroadcasterConfig.
|
BroadcasterConfig(java.util.List<java.lang.String> broadcastFilters,
AtmosphereConfig config,
java.lang.String broadcasterId)
Create a new BroadcasterConfig.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addFilter(BroadcastFilter e)
Add a
BroadcastFilter. |
protected boolean |
addFilter(BroadcastFilter e,
boolean init)
Add a
BroadcastFilter. |
java.util.List<java.lang.Object> |
applyFilters(AtmosphereResource r,
java.util.List<java.lang.Object> cacheMessages)
Apply all filters to the
AtmosphereResource and the provided List of messages. |
protected BroadcasterConfig |
broadcasterID(java.lang.String broadcasterId) |
protected void |
configExecutors() |
protected void |
configureSharedCacheExecutor() |
void |
destroy() |
protected void |
destroy(boolean force) |
protected BroadcastFilter.BroadcastAction |
filter(AtmosphereResource r,
java.lang.Object message,
java.lang.Object originalMessage)
Invoke
BroadcastFilters in the order they were added, with a unique AtmosphereRequest. |
protected BroadcastFilter.BroadcastAction |
filter(java.lang.Object object)
Invoke
BroadcastFilters in the order they were added. |
java.util.Collection<BroadcastFilter> |
filters()
Return the current list of installed
BroadcastFilters. |
void |
forceDestroy()
Force shutdown of all
ExecutorServices. |
java.util.concurrent.ExecutorService |
getAsyncWriteService()
Return the
ExecutorService this Broadcaster use for executing asynchronous write of events. |
AtmosphereConfig |
getAtmosphereConfig()
Return the
AtmosphereConfig value. |
BroadcasterCache |
getBroadcasterCache()
Get the
BroadcasterCache used for this Broadcaster. |
java.util.concurrent.ExecutorService |
getExecutorService()
Return the
ExecutorService this Broadcaster supports. |
java.util.concurrent.ScheduledExecutorService |
getScheduledExecutorService()
Return the
ScheduledExecutorService this Broadcaster supports. |
boolean |
handleExecutors() |
boolean |
hasFilters()
Check if this object contains
BroadcastFilters. |
boolean |
hasPerRequestFilters()
Check if this object contains
BroadcastFilters. |
BroadcasterConfig |
init()
Initialize BroadcastFilters and BroadcasterCache.
|
protected void |
initClusterExtension() |
void |
removeAllFilters()
Remove all
BroadcastFilters. |
boolean |
removeFilter(BroadcastFilter filter)
Remove a
BroadcastFilter. |
BroadcasterConfig |
setAsyncWriteService(java.util.concurrent.ExecutorService asyncWriteService)
Set an
ExecutorService which can be used to write
AtmosphereResourceEvent.getMessage(). |
BroadcasterConfig |
setAsyncWriteService(java.util.concurrent.ExecutorService asyncWriteService,
boolean isAsyncExecutorShared)
Set an
ExecutorService which can be used to write
AtmosphereResourceEvent.getMessage(). |
BroadcasterConfig |
setBroadcasterCache(BroadcasterCache broadcasterCache)
Set a
BroadcasterCache. |
BroadcasterConfig |
setExecutorService(java.util.concurrent.ExecutorService executorService)
Set an
ExecutorService which can be used to dispatch
AtmosphereResourceEvent. |
BroadcasterConfig |
setExecutorService(java.util.concurrent.ExecutorService executorService,
boolean isExecutorShared)
Set an
ExecutorService which can be used to dispatch
AtmosphereResourceEvent. |
BroadcasterConfig |
setScheduledExecutorService(java.util.concurrent.ScheduledExecutorService scheduler)
Set an
ExecutorService which can be used to dispatch
AtmosphereResourceEvents. |
protected java.lang.Object |
unwrap(java.lang.Object o) |
protected BroadcastFilter.BroadcastAction |
wrap(BroadcastFilter.BroadcastAction a,
boolean wasUnwraped) |
protected final java.util.concurrent.ConcurrentLinkedQueue<BroadcastFilter> filters
protected final java.util.concurrent.ConcurrentLinkedQueue<PerRequestBroadcastFilter> perRequestFilters
public BroadcasterConfig(java.util.List<java.lang.String> broadcastFilters,
AtmosphereConfig config,
java.lang.String broadcasterId)
public BroadcasterConfig(java.util.List<java.lang.String> broadcastFilters,
AtmosphereConfig config,
boolean handleExecutors,
java.lang.String broadcasterId)
public BroadcasterConfig(java.util.concurrent.ExecutorService executorService,
java.util.concurrent.ExecutorService asyncWriteService,
java.util.concurrent.ScheduledExecutorService scheduler,
AtmosphereConfig config,
java.lang.String broadcasterId)
public BroadcasterConfig init()
protected void configureSharedCacheExecutor()
protected BroadcasterConfig broadcasterID(java.lang.String broadcasterId)
protected void initClusterExtension()
public boolean handleExecutors()
protected void configExecutors()
public BroadcasterConfig setExecutorService(java.util.concurrent.ExecutorService executorService)
ExecutorService which can be used to dispatch
AtmosphereResourceEvent. By default, the result of ExecutorsFactory.getMessageDispatcher(AtmosphereConfig, String)
is used if this method is not invoked.executorService - to be used when broadcasting.public BroadcasterConfig setExecutorService(java.util.concurrent.ExecutorService executorService, boolean isExecutorShared)
ExecutorService which can be used to dispatch
AtmosphereResourceEvent. By default, the result of ExecutorsFactory.getMessageDispatcher(AtmosphereConfig, String)
is used if this method is not invoked.executorService - to be used when broadcasting.isExecutorShared - true if the life cycle of the ExecutorService will be executed by the application.
It means Atmosphere will NOT invoke the shutdown method when destroy()
is invoked.public java.util.concurrent.ExecutorService getExecutorService()
ExecutorService this Broadcaster supports.
By default it returns the result of ExecutorsFactory.getMessageDispatcher(AtmosphereConfig, String)}.public BroadcasterConfig setAsyncWriteService(java.util.concurrent.ExecutorService asyncWriteService)
ExecutorService which can be used to write
AtmosphereResourceEvent.getMessage(). By default, the result of ExecutorsFactory.getAsyncOperationExecutor(AtmosphereConfig, String)
is used if this method is not invoked.asyncWriteService - to be used when writing events.public BroadcasterConfig setAsyncWriteService(java.util.concurrent.ExecutorService asyncWriteService, boolean isAsyncExecutorShared)
ExecutorService which can be used to write
AtmosphereResourceEvent.getMessage(). By default, the result of ExecutorsFactory.getAsyncOperationExecutor(AtmosphereConfig, String)
is used if this method is not invoked.asyncWriteService - to be used when writing events.isAsyncExecutorShared - true if the life cycle of the ExecutorService will be executed by the application.
It means Atmosphere will NOT invoke the shutdown method when this destroy()
is invoked.public java.util.concurrent.ExecutorService getAsyncWriteService()
ExecutorService this Broadcaster use for executing asynchronous write of events.
By default it returns the result of ExecutorsFactory.getAsyncOperationExecutor(AtmosphereConfig, String).public boolean addFilter(BroadcastFilter e)
BroadcastFilter.e - BroadcastFilterprotected boolean addFilter(BroadcastFilter e, boolean init)
BroadcastFilter.e - BroadcastFilterpublic java.util.Collection<BroadcastFilter> filters()
BroadcastFilters.BroadcastFilterspublic void destroy()
protected void destroy(boolean force)
public void forceDestroy()
ExecutorServices.public boolean removeFilter(BroadcastFilter filter)
BroadcastFilter.filter - BroadcastFilterpublic void removeAllFilters()
BroadcastFilters.public boolean hasFilters()
BroadcastFilters.BroadcastFilterspublic boolean hasPerRequestFilters()
BroadcastFilters.BroadcastFiltersprotected BroadcastFilter.BroadcastAction filter(java.lang.Object object)
BroadcastFilters in the order they were added.object - the broadcasted object.protected BroadcastFilter.BroadcastAction filter(AtmosphereResource r, java.lang.Object message, java.lang.Object originalMessage)
BroadcastFilters in the order they were added, with a unique AtmosphereRequest.r - AtmosphereResourcemessage - the broadcasted object.message - the broadcasted object.public java.util.List<java.lang.Object> applyFilters(AtmosphereResource r, java.util.List<java.lang.Object> cacheMessages)
AtmosphereResource and the provided List of messages.r - AtmosphereResourcecacheMessages - list of messagespublic BroadcasterConfig setScheduledExecutorService(java.util.concurrent.ScheduledExecutorService scheduler)
ExecutorService which can be used to dispatch
AtmosphereResourceEvents. By default a ScheduledExecutorService
is used if this method is not invoked.scheduler - to be used when broadcasting.public java.util.concurrent.ScheduledExecutorService getScheduledExecutorService()
ScheduledExecutorService this Broadcaster supports.
By default it returns an Executors.newScheduledThreadPool(int) and will use
the underlying number of core/protocol as an indication of the thread number.public BroadcasterConfig setBroadcasterCache(BroadcasterCache broadcasterCache)
BroadcasterCache.broadcasterCache - a BroadcasterCachepublic BroadcasterCache getBroadcasterCache()
BroadcasterCache used for this Broadcaster.BroadcasterCacheprotected java.lang.Object unwrap(java.lang.Object o)
protected BroadcastFilter.BroadcastAction wrap(BroadcastFilter.BroadcastAction a, boolean wasUnwraped)
public AtmosphereConfig getAtmosphereConfig()
AtmosphereConfig value. This value might be null
if the associated Broadcaster has been created manually.AtmosphereConfigCopyright © 2021. All Rights Reserved.