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 Executor for execution.
| Modifier and Type | Class and Description |
|---|---|
private static class |
ProduceConsume.State |
ExecutionStrategy.Producer| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.Executor |
_executor |
private Locker |
_locker |
private ExecutionStrategy.Producer |
_producer |
private ProduceConsume.State |
_state |
private static Logger |
LOG |
| Constructor and Description |
|---|
ProduceConsume(ExecutionStrategy.Producer producer,
java.util.concurrent.Executor executor) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispatch()
Initiates (or resumes) the task production and consumption.
|
void |
produce()
Initiates (or resumes) the task production and consumption.
|
void |
run() |
private static final Logger LOG
private final Locker _locker
private final ExecutionStrategy.Producer _producer
private final java.util.concurrent.Executor _executor
private ProduceConsume.State _state
public ProduceConsume(ExecutionStrategy.Producer producer, java.util.concurrent.Executor executor)
public void produce()
ExecutionStrategyInitiates (or resumes) the task production and consumption.
The produced task may be run by the same thread that called this method.
produce in interface ExecutionStrategyExecutionStrategy.dispatch()public void dispatch()
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)dispatch in interface ExecutionStrategyExecutionStrategy.produce()public void run()
run in interface java.lang.Runnable