mirror of
https://github.com/jetty/jetty.project.git
synced 2025-03-03 12:29:31 +00:00
Bah humbug
This commit is contained in:
parent
a89a6927e8
commit
fd605248dc
@ -56,6 +56,37 @@ public interface ExecutionStrategy
|
||||
Runnable produce();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>A strategy where the caller thread iterates over task production, submitting each
|
||||
* task to an {@link Executor} for execution.</p>
|
||||
*/
|
||||
public static class ProduceRun implements ExecutionStrategy
|
||||
{
|
||||
private final Producer _producer;
|
||||
|
||||
public ProduceRun(Producer producer)
|
||||
{
|
||||
this._producer = producer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute()
|
||||
{
|
||||
// Iterate until we are complete.
|
||||
while (true)
|
||||
{
|
||||
// Produce a task.
|
||||
Runnable task = _producer.produce();
|
||||
|
||||
if (task == null)
|
||||
break;
|
||||
|
||||
// run the task.
|
||||
task.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>A strategy where the caller thread iterates over task production, submitting each
|
||||
* task to an {@link Executor} for execution.</p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user