private static <T, BT extends Procedure<? super T>> void combineSingleProcedure(Combiner<BT> combiner, BT procedure) { if (combiner.useCombineOne()) { combiner.combineOne(procedure); } else { combiner.combineAll(iList(procedure)); } } }
private void combineTasks() { if (!this.combiner.useCombineOne()) { this.combiner.combineAll(ArrayIterate.collect(this.procedures, this.procedureFunction)); } }
private void join() { try { if (this.combiner.useCombineOne()) { int remainingTaskCount = this.taskCount; while (remainingTaskCount > 0) { this.combiner.combineOne(this.outputQueue.take()); remainingTaskCount--; } } else { this.latch.await(); } } catch (InterruptedException e) { throw new RuntimeException("Combine failed", e); } }
private static <BT> CountDownLatch buildCountDownLatch(Combiner<BT> newCombiner, int taskCount) { return newCombiner.useCombineOne() ? null : new CountDownLatch(taskCount); }
private void join() { try { int remainingTaskCount = this.taskCount; while (remainingTaskCount > 0) { this.combiner.combineOne(this.outputQueue.take()); remainingTaskCount--; } } catch (InterruptedException e) { throw new RuntimeException("Combine failed", e); } }
private void combineTasks() { if (!this.combiner.useCombineOne()) { this.combiner.combineAll(ArrayIterate.collect(this.procedures, this.procedureFunction)); } }
private void join() { try { if (this.combiner.useCombineOne()) { int remaingTaskCount = this.taskCount; while (remaingTaskCount > 0) { this.combiner.combineOne(this.outputQueue.take()); remaingTaskCount--; } } else { this.latch.await(); } } catch (InterruptedException e) { throw new RuntimeException("Combine failed", e); } }
private static <BT> ArrayBlockingQueue<BT> buildQueue(Combiner<BT> newCombiner, int taskCount) { return newCombiner.useCombineOne() ? new ArrayBlockingQueue<>(taskCount) : null; }
private void join() { try { int remainingTaskCount = this.taskCount; while (remainingTaskCount > 0) { this.combiner.combineOne(this.outputQueue.take()); remainingTaskCount--; } } catch (InterruptedException e) { throw new RuntimeException("Combine failed", e); } }
private static <T, BT extends Procedure<? super T>> void combineSingleProcedure(Combiner<BT> combiner, BT procedure) { if (combiner.useCombineOne()) { combiner.combineOne(procedure); } else { combiner.combineAll(iList(procedure)); } } }
private void combineTasks() { if (!this.combiner.useCombineOne()) { this.combiner.combineAll(ArrayIterate.collect(this.procedures, this.procedureFunction)); } }
private void join() { try { if (this.combiner.useCombineOne()) { int remaingTaskCount = this.taskCount; while (remaingTaskCount > 0) { this.combiner.combineOne(this.outputQueue.take()); remaingTaskCount--; } } else { this.latch.await(); } } catch (InterruptedException e) { throw new RuntimeException("Combine failed", e); } }
private static <BT> CountDownLatch buildCountDownLatch(Combiner<BT> newCombiner, int taskCount) { return newCombiner.useCombineOne() ? null : new CountDownLatch(taskCount); }
private void join() { try { int remainingTaskCount = this.taskCount; while (remainingTaskCount > 0) { this.combiner.combineOne(this.outputQueue.take()); remainingTaskCount--; } } catch (InterruptedException e) { throw new RuntimeException("Combine failed", e); } }
public static <T, BT extends Procedure<? super T>> void forEachInListOnExecutor( List<T> list, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor) { int size = list.size(); if (size < minForkSize) { BT procedure = procedureFactory.create(); Iterate.forEach(list, procedure); if (combiner.useCombineOne()) { combiner.combineOne(procedure); } else { combiner.combineAll(iList(procedure)); } } else { int threadCount = Math.min(size, taskCount); ProcedureFJTaskRunner<T, BT> runner = new ProcedureFJTaskRunner<>(combiner, threadCount); runner.executeAndCombine(executor, procedureFactory, list); } }
private void combineTasks() { if (!this.combiner.useCombineOne()) { this.combiner.combineAll(ArrayIterate.collect(this.procedures, this.procedureFunction)); } }
private void join() { try { if (this.combiner.useCombineOne()) { int remainingTaskCount = this.taskCount; while (remainingTaskCount > 0) { this.combiner.combineOne(this.outputQueue.take()); remainingTaskCount--; } } else { this.latch.await(); } } catch (InterruptedException e) { throw new RuntimeException("Combine failed", e); } }
private static <BT> ArrayBlockingQueue<BT> buildQueue(Combiner<BT> newCombiner, int taskCount) { return newCombiner.useCombineOne() ? new ArrayBlockingQueue<>(taskCount) : null; }
public static <T, BT extends ObjectIntProcedure<? super T>> void forEachWithIndexInListOnExecutor( List<T> list, ObjectIntProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor) { int size = list.size(); if (size < minForkSize) { BT procedure = procedureFactory.create(); Iterate.forEachWithIndex(list, procedure); if (combiner.useCombineOne()) { combiner.combineOne(procedure); } else { combiner.combineAll(iList(procedure)); } } else { int threadCount = Math.min(size, taskCount); ObjectIntProcedureFJTaskRunner<T, BT> runner = new ObjectIntProcedureFJTaskRunner<>(combiner, threadCount); runner.executeAndCombine(executor, procedureFactory, list); } }
private void combineTasks() { if (!this.combiner.useCombineOne()) { this.combiner.combineAll(ArrayIterate.collect(this.procedures, this.procedureFunction)); } }