Constructor and Description |
---|
OrderedExecutor(int numThreads,
ExecutorService delegate) |
Modifier and Type | Method and Description |
---|---|
void |
execute(Integer lockId,
Runnable command)
Execute the given command in the future.
|
void |
execute(Runnable runnable) |
void |
shutdownAndAwaitTermination() |
public OrderedExecutor(int numThreads, ExecutorService delegate)
public void execute(Integer lockId, Runnable command)
lockId
is waiting in the queue or running,
this method will block until that command finish.
Therefore different commands with same hash
will be executed in order of calling this method.
If multiple caller are waiting for a command to finish, there are no guarantee that the earliest call will win.lockId
- of the command
, if null then a random hash will be generatedcommand
- the runnable taskRejectedExecutionException
- if this task cannot be accepted for executionpublic void shutdownAndAwaitTermination()
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.