public class UnorderedParallelEventReceivingStrategy extends java.util.concurrent.ThreadPoolExecutor implements EventReceivingStrategy
EventReceivingStrategy
that dispatches Event
s using a
thread pool but without any ordering guarantees.java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
Constructor and Description |
---|
UnorderedParallelEventReceivingStrategy() |
UnorderedParallelEventReceivingStrategy(int coreThreads,
int maxThreads,
int maxQueue) |
Modifier and Type | Method and Description |
---|---|
void |
addFilter(Filter filter)
Adds a filter that is applied for all registered handlers some time after
this method call.
|
void |
addHandler(Handler handler,
boolean wait) |
void |
handle(Event event) |
void |
removeFilter(Filter filter)
Removes a filter that is remove for all registered handlers some time
after this method call.
|
void |
removeHandler(Handler handler,
boolean wait) |
void |
shutdownAndWait() |
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toString
public UnorderedParallelEventReceivingStrategy()
public UnorderedParallelEventReceivingStrategy(int coreThreads, int maxThreads, int maxQueue)
public void addFilter(Filter filter)
EventReceivingStrategy
addFilter
in interface EventReceivingStrategy
filter
- filter to add, not null
public void removeFilter(Filter filter)
EventReceivingStrategy
removeFilter
in interface EventReceivingStrategy
filter
- filter to remove, not null
public void addHandler(Handler handler, boolean wait)
addHandler
in interface EventReceivingStrategy
public void removeHandler(Handler handler, boolean wait) throws java.lang.InterruptedException
removeHandler
in interface EventReceivingStrategy
java.lang.InterruptedException
public void handle(Event event)
handle
in interface EventHandler
public void shutdownAndWait() throws java.lang.InterruptedException
shutdownAndWait
in interface EventReceivingStrategy
java.lang.InterruptedException
- thrown if waiting for shutdown was interrupted.