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.
ExecutionStrategy.Factory, ExecutionStrategy.Producer
Constructor and Description |
---|
ProduceConsume(ExecutionStrategy.Producer producer,
Executor executor) |
Modifier and Type | Method and Description |
---|---|
void |
dispatch()
Initiates (or resumes) the task production and execution.
|
void |
execute()
Initiates (or resumes) the task production and execution.
|
void |
run() |
public ProduceConsume(ExecutionStrategy.Producer producer, Executor executor)
public void execute()
ExecutionStrategy
Initiates (or resumes) the task production and execution.
The produced task may be run by the same thread that called this method.
execute
in interface ExecutionStrategy
ExecutionStrategy.dispatch()
public void dispatch()
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.
dispatch
in interface ExecutionStrategy
ExecutionStrategy.execute()
Copyright © 1995-2015 Webtide. All Rights Reserved.