Class ProduceConsume
- java.lang.Object
-
- org.eclipse.jetty.util.thread.strategy.ProduceConsume
-
- All Implemented Interfaces:
java.lang.Runnable,ExecutionStrategy
public class ProduceConsume extends java.lang.Object implements ExecutionStrategy, java.lang.Runnable
A strategy where the caller thread iterates over task production, submitting each task to an
Executorfor execution.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classProduceConsume.State-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.ExecutionStrategy
ExecutionStrategy.Producer
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.Executor_executorprivate Locker_lockerprivate ExecutionStrategy.Producer_producerprivate ProduceConsume.State_stateprivate static LoggerLOG
-
Constructor Summary
Constructors Constructor Description ProduceConsume(ExecutionStrategy.Producer producer, java.util.concurrent.Executor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispatch()Initiates (or resumes) the task production and consumption.voidproduce()Initiates (or resumes) the task production and consumption.voidrun()
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
_locker
private final Locker _locker
-
_producer
private final ExecutionStrategy.Producer _producer
-
_executor
private final java.util.concurrent.Executor _executor
-
_state
private ProduceConsume.State _state
-
-
Constructor Detail
-
ProduceConsume
public ProduceConsume(ExecutionStrategy.Producer producer, java.util.concurrent.Executor executor)
-
-
Method Detail
-
produce
public void produce()
Description copied from interface:ExecutionStrategyInitiates (or resumes) the task production and consumption.
The produced task may be run by the same thread that called this method.
- Specified by:
producein interfaceExecutionStrategy- See Also:
ExecutionStrategy.dispatch()
-
dispatch
public void dispatch()
Description copied from interface:ExecutionStrategyInitiates (or resumes) the task production and consumption.
This method guarantees that the task is never run by the thread that called this method.
TODO review the need for this (only used by HTTP2 push)- Specified by:
dispatchin interfaceExecutionStrategy- See Also:
ExecutionStrategy.produce()
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
-