Package de.hsh.graja.regression
Class WorkerPool
- java.lang.Object
-
- de.hsh.graja.regression.WorkerPool
-
public class WorkerPool extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
WorkerPool.Consumer
static class
WorkerPool.Worker
-
Constructor Summary
Constructors Constructor Description WorkerPool(int maxConcurrentTasks)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doRun(Logging log, Iterable<? extends WorkerPool.Worker> initialWorkers, WorkerPool.Consumer consumer)
void
enqueue(WorkerPool.Worker worker, WorkerPool.Consumer consumer)
void
resume(Thread t)
boolean
suspendMeIf(Supplier<Boolean> check)
Suspends the current thread, if the check is true.
-
-
-
Method Detail
-
enqueue
public void enqueue(WorkerPool.Worker worker, WorkerPool.Consumer consumer)
-
doRun
public void doRun(Logging log, Iterable<? extends WorkerPool.Worker> initialWorkers, WorkerPool.Consumer consumer) throws Exception
- Throws:
Exception
-
suspendMeIf
public boolean suspendMeIf(Supplier<Boolean> check)
Suspends the current thread, if the check is true. This method returns after some other thread has called resume for this thread.- Parameters:
check
- The check is executed non-concurrent when no other pooled thread is executing- Returns:
- true, if the thread was suspended.
-
resume
public void resume(Thread t)
-
-