Package hudson.util
Class SequentialExecutionQueue
- java.lang.Object
-
- hudson.util.SequentialExecutionQueue
-
- All Implemented Interfaces:
Executor
public class SequentialExecutionQueue extends Object implements Executor
Executorthat collapses two equalRunnables into one, and makes sure no two equalRunnables get executed simultaneously.That is, if a
Runnableis executing and another one gets submitted, the 2nd one waits for the completion of the 1st one.Object.equals(Object)is used onRunnableto identify two equalRunnables.- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Constructor Description SequentialExecutionQueue(ExecutorService executors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(Runnable item)ExecutorServicegetExecutors()Gets the base underlying executors.,Set<Runnable>getInProgress()GetsRunnables that are currently executed by a live thread.booleanisStarving(long threshold)Returns true if too much time is spent since someRunnableis submitted into the queue until they get executed.voidsetExecutors(ExecutorService svc)Starts using a newExecutorServiceto carry out executions.
-
-
-
Constructor Detail
-
SequentialExecutionQueue
public SequentialExecutionQueue(ExecutorService executors)
-
-
Method Detail
-
getExecutors
public ExecutorService getExecutors()
Gets the base underlying executors.,
-
setExecutors
public void setExecutors(ExecutorService svc)
Starts using a newExecutorServiceto carry out executions.The older
ExecutorServicewill be shut down (but it's still expected to complete whatever they are doing and scheduled.)
-
isStarving
public boolean isStarving(long threshold)
Returns true if too much time is spent since someRunnableis submitted into the queue until they get executed.
-
-