Package org.apache.solr.util
Class OrderedExecutor
- java.lang.Object
-
- org.apache.solr.util.OrderedExecutor
-
-
Constructor Summary
Constructors Constructor Description OrderedExecutor(int numThreads, ExecutorService delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(Integer lockId, Runnable command)
Execute the given command in the future.void
execute(Runnable runnable)
void
shutdownAndAwaitTermination()
-
-
-
Constructor Detail
-
OrderedExecutor
public OrderedExecutor(int numThreads, ExecutorService delegate)
-
-
Method Detail
-
execute
public void execute(Integer lockId, Runnable command)
Execute the given command in the future. If another command with samelockId
is waiting in the queue or running, this method will block until that command finish. Therefore different commands with samehash
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.
- Parameters:
lockId
- of thecommand
, if null then a random hash will be generatedcommand
- the runnable task- Throws:
RejectedExecutionException
- if this task cannot be accepted for execution
-
shutdownAndAwaitTermination
public void shutdownAndAwaitTermination()
-
-