Class ProduceConsume
- java.lang.Object
-
- org.eclipse.jetty.util.thread.strategy.ProduceConsume
-
- All Implemented Interfaces:
Runnable
,ExecutionStrategy
public class ProduceConsume extends Object implements ExecutionStrategy, Runnable
A strategy where the caller thread iterates over task production, submitting each task to an
Executor
for execution.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProduceConsume.Factory
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.ExecutionStrategy
ExecutionStrategy.DefaultExecutionStrategyFactory, ExecutionStrategy.Producer, ExecutionStrategy.Rejectable
-
-
Constructor Summary
Constructors Constructor Description ProduceConsume(ExecutionStrategy.Producer producer, Executor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispatch()
Initiates (or resumes) the task production and execution.void
execute()
Initiates (or resumes) the task production and execution.void
run()
-
-
-
Constructor Detail
-
ProduceConsume
public ProduceConsume(ExecutionStrategy.Producer producer, Executor executor)
-
-
Method Detail
-
execute
public void execute()
Description copied from interface:ExecutionStrategy
Initiates (or resumes) the task production and execution.
The produced task may be run by the same thread that called this method.
- Specified by:
execute
in interfaceExecutionStrategy
- See Also:
ExecutionStrategy.dispatch()
-
dispatch
public void dispatch()
Description copied from interface:ExecutionStrategy
Initiates (or resumes) the task production and execution.
This method guarantees that the task is never run by the thread that called this method.
- Specified by:
dispatch
in interfaceExecutionStrategy
- See Also:
ExecutionStrategy.execute()
-
-