java.util.concurrent.Executor
, java.util.concurrent.ExecutorService
public final class ImmediateExecutorService
extends java.util.concurrent.AbstractExecutorService
ExecutorService
which runs all tasks on thread the call was made from
This is useful as a quick implementation, and should be used only when blocking is fine
Constructor | Description |
---|---|
ImmediateExecutorService() |
Modifier and Type | Method | Description |
---|---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
No-op
|
void |
execute(java.lang.Runnable command) |
Immediately runs the passed command, unless shutdown flag is set
If shutdown flag is set, this is a no-op
|
boolean |
isShutdown() |
Returns the shutdown flag set by
shutdown() and shutdownNow() |
boolean |
isTerminated() |
Returns the shutdown flag set by
shutdown() and shutdownNow() |
void |
shutdown() |
Sets the shutdown flag just for
isShutdown() and isTerminated() methods |
java.util.List<java.lang.Runnable> |
shutdownNow() |
Returns an empty list of runnables, since it can't hold any and sets the same flag as
shutdown() |
public void shutdown()
isShutdown()
and isTerminated()
methodspublic java.util.List<java.lang.Runnable> shutdownNow()
shutdown()
public boolean isShutdown()
shutdown()
and shutdownNow()
public boolean isTerminated()
shutdown()
and shutdownNow()
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
java.lang.InterruptedException
public void execute(java.lang.Runnable command)
command
- to runCopyright © 2018. All rights reserved.