EventExecutor
implementation which makes no guarantees about the ordering of task execution that
are submitted because there may be multiple threads executing these tasks.
This implementation is most useful for protocols that do not need strict ordering.
Because it provides no ordering care should be taken when using it!
Modifier and Type | Class and Description |
---|---|
private static class | |
private static class |
Modifier and Type | Field and Description |
---|---|
private final Set | |
private static final InternalLogger | |
private final Promise |
Access | Constructor and Description |
---|---|
public | |
public | UnorderedThreadPoolEventExecutor(int corePoolSize, ThreadFactory threadFactory)
See |
public | |
public | UnorderedThreadPoolEventExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler)
|
Modifier and Type | Method and Description |
---|---|
protected <V> RunnableScheduledFuture | decorateTask(Runnable
the submitted Runnable runnable, RunnableScheduledFuture<V> the task created to execute the runnable task)Overrides java. |
protected <V> RunnableScheduledFuture | decorateTask(Callable<V>
the submitted Callable callable, RunnableScheduledFuture<V> the task created to execute the callable task)Overrides java. |
public void | execute(Runnable
the runnable task command)Overrides java. Implements java. |
public boolean | inEventLoop()
Implements io. inEventLoop(Thread) with Thread#currentThread() as argument
|
public boolean | inEventLoop(Thread thread)
Implements io. true if the given Thread is executed in the event loop,
false otherwise.
|
public boolean | isShuttingDown()
Implements io. true if and only if all EventExecutor s managed by this EventExecutorGroup
are being shut down gracefully or was shut down.
|
public Iterator | iterator()
Implements io. T .
|
public <V> Future | newFailedFuture(Throwable cause)
Implements io. Future which is marked as failed already.
|
public <V> ProgressivePromise | newProgressivePromise()
Implements io. ProgressivePromise .
|
public <V> Promise | |
public <V> Future | newSucceededFuture(V result)
Implements io. Future which is marked as succeeded already.
|
public EventExecutor | |
public EventExecutorGroup | parent()
Implements io. EventExecutorGroup which is the parent of this EventExecutor ,
|
public ScheduledFuture | schedule(Runnable
the task to execute command, long the time from now to delay execution delay, TimeUnit the time unit of the delay parameter unit)Overrides java. Implements io. |
public <V> ScheduledFuture | schedule(Callable<V>
the function to execute callable, long the time from now to delay execution delay, TimeUnit the time unit of the delay parameter unit)Overrides java. Implements io. |
public ScheduledFuture | scheduleAtFixedRate(Runnable
the task to execute command, long the time to delay first execution initialDelay, long the period between successive executions period, TimeUnit the time unit of the initialDelay and period parameters unit)Overrides java. Implements io. initialDelay , then initialDelay + period , then
initialDelay + 2 * period , and so on.
|
public ScheduledFuture | scheduleWithFixedDelay(Runnable
the task to execute command, long the time to delay first execution initialDelay, long the delay between the termination of one
execution and the commencement of the next delay, TimeUnit the time unit of the initialDelay and delay parameters unit)Overrides java. Implements io. |
public void | shutdown()
Overrides java. Implements io. |
public Future | shutdownGracefully()
Implements io. shutdownGracefully(long, long, TimeUnit) with sensible default values.
|
public Future | shutdownGracefully(long
the quiet period as described in the documentation quietPeriod, long the maximum amount of time to wait until the executor is shutdown()
regardless if a task was submitted during the quiet period timeout, TimeUnit the unit of unit)quietPeriod and timeout Implements io. |
public List | shutdownNow()
Overrides java. Implements io. |
public Future | submit(Runnable
the task to submit task)Overrides java. Implements io. |
public <T> Future | submit(Runnable
the task to submit task, T the result to return result)Overrides java. Implements io. |
public <T> Future | submit(Callable<T>
the task to submit task)Overrides java. Implements io. |
public Future | terminationFuture()
Implements io. Future which is notified when all EventExecutor s managed by this
EventExecutorGroup have been terminated.
|
executorSet | back to summary |
---|---|
private final Set<EventExecutor> executorSet |
logger | back to summary |
---|---|
private static final InternalLogger logger |
terminationFuture | back to summary |
---|---|
private final Promise<?> terminationFuture |
UnorderedThreadPoolEventExecutor | back to summary |
---|---|
public UnorderedThreadPoolEventExecutor(int corePoolSize) Calls |
UnorderedThreadPoolEventExecutor | back to summary |
---|---|
public UnorderedThreadPoolEventExecutor(int corePoolSize, ThreadFactory threadFactory) See |
UnorderedThreadPoolEventExecutor | back to summary |
---|---|
public UnorderedThreadPoolEventExecutor(int corePoolSize, RejectedExecutionHandler handler) Calls |
UnorderedThreadPoolEventExecutor | back to summary |
---|---|
public UnorderedThreadPoolEventExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler) |
decorateTask | back to summary |
---|---|
protected <V> RunnableScheduledFuture Overrides java. Doc from java. Modifies or replaces the task used to execute a runnable. This method can be used to override the concrete class used for managing internal tasks. The default implementation simply returns the given task.
|
decorateTask | back to summary |
---|---|
protected <V> RunnableScheduledFuture Overrides java. Doc from java. Modifies or replaces the task used to execute a callable. This method can be used to override the concrete class used for managing internal tasks. The default implementation simply returns the given task.
|
execute | back to summary |
---|---|
public void execute(Runnable command) Overrides java. Implements java. Doc from java. Executes the given command at some time in the future. The command
may execute in a new thread, in a pooled thread, or in the calling
thread, at the discretion of the |
inEventLoop | back to summary |
---|---|
public boolean inEventLoop() Implements io. Doc from io. Calls
|
inEventLoop | back to summary |
---|---|
public boolean inEventLoop(Thread thread) Implements io. Doc from io. Return
|
isShuttingDown | back to summary |
---|---|
public boolean isShuttingDown() Implements io. Doc from io. Returns
|
iterator | back to summary |
---|---|
public Iterator Implements io. Doc from java. Returns an iterator over elements of type
|
newFailedFuture | back to summary |
---|---|
public <V> Future Implements io. Doc from io. Create a new
|
newProgressivePromise | back to summary |
---|---|
public <V> ProgressivePromise Implements io. Doc from io. Create a new
|
newPromise | back to summary |
---|---|
public <V> Promise Implements io. Doc from io. Return a new
|
newSucceededFuture | back to summary |
---|---|
public <V> Future Implements io. Doc from io. Create a new
|
next | back to summary |
---|---|
public EventExecutor next() Implements io. Doc from io. Returns a reference to itself.
|
parent | back to summary |
---|---|
public EventExecutorGroup parent() Implements io. Doc from io. Return the
|
schedule | back to summary |
---|---|
public ScheduledFuture Overrides java. Implements io. Doc from java. Submits a one-shot task that becomes enabled after the given delay.
|
schedule | back to summary |
---|---|
public <V> ScheduledFuture Overrides java. Implements io. Doc from java. Submits a value-returning one-shot task that becomes enabled after the given delay.
|
scheduleAtFixedRate | back to summary |
---|---|
public ScheduledFuture Overrides java. Implements io. Doc from java. Submits a periodic action that becomes enabled first after the
given initial delay, and subsequently with the given period;
that is, executions will commence after
The sequence of task executions continues indefinitely until one of the following exceptional completions occur:
isDone() on the returned future will
return true .
If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.
|
scheduleWithFixedDelay | back to summary |
---|---|
public ScheduledFuture Overrides java. Implements io. Doc from java. Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next. The sequence of task executions continues indefinitely until one of the following exceptional completions occur:
isDone() on the returned future will
return true .
|
shutdown | back to summary |
---|---|
public void shutdown() Overrides java. Implements io. Doc from java. Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down. This method does not wait for previously submitted tasks to
complete execution. Use
|
shutdownGracefully | back to summary |
---|---|
public Future Implements io. Doc from io. Shortcut method for
|
shutdownGracefully | back to summary |
---|---|
public Future Implements io. Doc from io. Signals this executor that the caller wants the executor to be shut down. Once this method is called,
|
shutdownNow | back to summary |
---|---|
public List Overrides java. Implements io. Doc from java. Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution. This method does not wait for actively executing tasks to
terminate. Use There are no guarantees beyond best-effort attempts to stop
processing actively executing tasks. For example, typical
implementations will cancel via |
submit | back to summary |
---|---|
public Future Overrides java. Implements io. Doc from java. Submits a Runnable task for execution and returns a Future
representing that task. The Future's |
submit | back to summary |
---|---|
public <T> Future Overrides java. Implements io. Doc from java. Submits a Runnable task for execution and returns a Future
representing that task. The Future's |
submit | back to summary |
---|---|
public <T> Future Overrides java. Implements io. Doc from java. Submits a value-returning task for execution and returns a
Future representing the pending results of the task. The
Future's
If you would like to immediately block waiting
for a task, you can use constructions of the form
Note The |
terminationFuture | back to summary |
---|---|
public Future Implements io. Doc from io. Returns the
|
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public void |
task | back to summary |
---|---|
private final Runnable task |
NonNotifyRunnable | back to summary |
---|---|
pack-priv NonNotifyRunnable(Runnable task) |
run | back to summary |
---|---|
public void run() Implements java. Doc from java. Runs this operation.
|
Modifier and Type | Field and Description |
---|---|
private final RunnableScheduledFuture | |
private final boolean |
Access | Constructor and Description |
---|---|
pack-priv | RunnableScheduledFutureTask(EventExecutor executor, RunnableScheduledFuture<V> future, boolean wasCallable)
|
Modifier and Type | Method and Description |
---|---|
public int | compareTo(Delayed
the object to be compared. o)Implements java. |
public long | getDelay(TimeUnit
the time unit unit)Implements java. |
public boolean | isPeriodic()
Implements java. true if this task is periodic.
|
public void | run()
Overrides io. Implements java. |
pack-priv V |
future | back to summary |
---|---|
private final RunnableScheduledFuture<V> future |
wasCallable | back to summary |
---|---|
private final boolean wasCallable |
RunnableScheduledFutureTask | back to summary |
---|---|
pack-priv RunnableScheduledFutureTask(EventExecutor executor, RunnableScheduledFuture<V> future, boolean wasCallable) |
compareTo | back to summary |
---|---|
public int compareTo(Delayed o) Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that |
getDelay | back to summary |
---|---|
public long getDelay(TimeUnit unit) Implements java. Doc from java. Returns the remaining delay associated with this object, in the given time unit. |
isPeriodic | back to summary |
---|---|
public boolean isPeriodic() Implements java. Doc from java. Returns
|
run | back to summary |
---|---|
public void run() Overrides io. Implements java. Doc from java. Sets this Future to the result of its computation unless it has been cancelled.
|
runTask | back to summary |
---|---|
pack-priv V runTask() throws Throwable Overrides io.
|