Updated object pool

This commit is contained in:
nathan 2016-03-06 23:58:54 +01:00
parent ef02ca2087
commit 4a471e3137

View File

@ -51,7 +51,7 @@ class ParallelProcessor<T extends ParallelTask> {
this.totalTaskCount = totalTaskCount - 1; // x-1 because our ID's start at 0, not 1
this.collector = collector;
pool = new ObjectPool<T>(poolableObject, numberOfThreads);
pool = ObjectPool.Blocking(poolableObject, numberOfThreads);
this.processedCount = new AtomicInteger();
this.assignedCount = new AtomicInteger();
@ -102,7 +102,7 @@ class ParallelProcessor<T extends ParallelTask> {
collector.taskComplete(work);
final int i = processedCount.getAndIncrement();
pool.release(work); // last valid position for 'work', since this releases it back so the client can reuse it
pool.put(work); // last valid position for 'work', since this releases it back so the client can reuse it
if (i == totalTaskCount) {
isShuttingDown = true;