@Override public void run() { try { this.procedure = this.procedureFactory.create(); ArrayIterate.forEach(this.array, this.start, this.end - 1, this.procedure); } catch (Throwable newError) { this.taskRunner.setFailed(newError); } finally { this.taskRunner.taskCompleted(this); } }
@Override public void run() { try { this.procedure = this.procedureFactory.create(); ArrayIterate.forEach(this.array, this.start, this.end - 1, this.procedure); } catch (Throwable newError) { this.taskRunner.setFailed(newError); } finally { this.taskRunner.taskCompleted(this); } }
@Override public void run() { try { this.procedure = this.procedureFactory.create(); this.iterable.batchForEach(this.procedure, this.sectionIndex, this.sectionCount); } catch (Throwable newError) { this.taskRunner.setFailed(newError); } finally { this.taskRunner.taskCompleted(this); } }
@Override public void run() { try { this.procedure = this.procedureFactory.create(); this.iterable.batchForEach(this.procedure, this.sectionIndex, this.sectionCount); } catch (Throwable newError) { this.taskRunner.setFailed(newError); } finally { this.taskRunner.taskCompleted(this); } }
public static <T, BT extends Procedure<? super T>> void forEachOn( T[] array, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor) { if (ArrayIterate.notEmpty(array)) { int size = array.length; if (size < minForkSize) { BT procedure = procedureFactory.create(); ArrayIterate.forEach(array, procedure); ParallelArrayIterate.combineSingleProcedure(combiner, procedure); } else { int threadCount = Math.min(size, taskCount); new ArrayProcedureFJTaskRunner<>(combiner, threadCount).executeAndCombine(executor, procedureFactory, array); } } }
public static <T, BT extends Procedure<? super T>> void forEachOn( T[] array, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor) { if (ArrayIterate.notEmpty(array)) { int size = array.length; if (size < minForkSize) { BT procedure = procedureFactory.create(); ArrayIterate.forEach(array, procedure); ParallelArrayIterate.combineSingleProcedure(combiner, procedure); } else { int threadCount = Math.min(size, taskCount); new ArrayProcedureFJTaskRunner<>(combiner, threadCount).executeAndCombine(executor, procedureFactory, array); } } }
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); } }
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); } }
public static <T, BT extends Procedure<? super T>> void forEachInBatchWithExecutor( BatchIterable<T> set, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor) { int size = set.size(); if (size < minForkSize) { BT procedure = procedureFactory.create(); set.forEach(procedure); if (combiner.useCombineOne()) { combiner.combineOne(procedure); } else { combiner.combineAll(iList(procedure)); } } else { int threadCount = Math.min(size, Math.min(taskCount, set.getBatchCount((int) Math.ceil((double) size / (double) taskCount)))); BatchIterableProcedureFJTaskRunner<T, BT> runner = new BatchIterableProcedureFJTaskRunner<>(combiner, threadCount); runner.executeAndCombine(executor, procedureFactory, set); } }
public static <T, BT extends Procedure<? super T>> void forEachInBatchWithExecutor( BatchIterable<T> set, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor) { int size = set.size(); if (size < minForkSize) { BT procedure = procedureFactory.create(); set.forEach(procedure); if (combiner.useCombineOne()) { combiner.combineOne(procedure); } else { combiner.combineAll(iList(procedure)); } } else { int threadCount = Math.min(size, Math.min(taskCount, set.getBatchCount((int) Math.ceil((double) size / (double) taskCount)))); BatchIterableProcedureFJTaskRunner<T, BT> runner = new BatchIterableProcedureFJTaskRunner<>(combiner, threadCount); runner.executeAndCombine(executor, procedureFactory, set); } }
@Override public void run() { try { this.procedure = this.procedureFactory.create(); int stop = this.end - 1; if (this.list instanceof ListIterable) { ((ListIterable<T>) this.list).forEach(this.start, stop, this.procedure); } else if (this.list instanceof ArrayList) { ArrayListIterate.forEach((ArrayList<T>) this.list, this.start, stop, this.procedure); } else { ListIterate.forEach(this.list, this.start, stop, this.procedure); } } catch (Throwable newError) { this.taskRunner.setFailed(newError); } finally { this.taskRunner.taskCompleted(this); } }
@Override public void run() { try { this.procedure = this.procedureFactory.create(); int stop = this.end - 1; if (this.list instanceof ListIterable) { ((ListIterable<T>) this.list).forEach(this.start, stop, this.procedure); } else if (this.list instanceof ArrayList) { ArrayListIterate.forEach((ArrayList<T>) this.list, this.start, stop, this.procedure); } else { ListIterate.forEach(this.list, this.start, stop, this.procedure); } } catch (Throwable newError) { this.taskRunner.setFailed(newError); } finally { this.taskRunner.taskCompleted(this); } }
@Override public void run() { try { this.procedure = this.procedureFactory.create(); this.iterable.batchForEach(this.procedure, this.sectionIndex, this.sectionCount); } catch (Throwable newError) { this.taskRunner.setFailed(newError); } finally { this.taskRunner.taskCompleted(this); } }
@Override protected boolean exec() { try { this.procedure = this.procedureFactory.create(); this.iterable.batchForEach(this.procedure, this.sectionIndex, this.sectionCount); } catch (Throwable newError) { this.taskRunner.setFailed(newError); } finally { this.taskRunner.taskCompleted(this); } return true; }
@Override public void run() { try { this.procedure = this.procedureFactory.create(); ArrayIterate.forEach(this.array, this.start, this.end - 1, this.procedure); } catch (Throwable newError) { this.taskRunner.setFailed(newError); } finally { this.taskRunner.taskCompleted(this); } }
public static <T, BT extends Procedure<? super T>> void forEachOn( T[] array, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor) { if (ArrayIterate.notEmpty(array)) { int size = array.length; if (size < minForkSize) { BT procedure = procedureFactory.create(); ArrayIterate.forEach(array, procedure); ParallelArrayIterate.combineSingleProcedure(combiner, procedure); } else { int threadCount = Math.min(size, taskCount); new ArrayProcedureFJTaskRunner<>(combiner, threadCount).executeAndCombine(executor, procedureFactory, array); } } }
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); } }
public static <T, BT extends Procedure<? super T>> void forEachInBatchWithExecutor( BatchIterable<T> set, ProcedureFactory<BT> procedureFactory, Combiner<BT> combiner, int minForkSize, int taskCount, Executor executor) { int size = set.size(); if (size < minForkSize) { BT procedure = procedureFactory.create(); set.forEach(procedure); if (combiner.useCombineOne()) { combiner.combineOne(procedure); } else { combiner.combineAll(iList(procedure)); } } else { int threadCount = Math.min(size, Math.min(taskCount, set.getBatchCount((int) Math.ceil((double) size / (double) taskCount)))); BatchIterableProcedureFJTaskRunner<T, BT> runner = new BatchIterableProcedureFJTaskRunner<>(combiner, threadCount); runner.executeAndCombine(executor, procedureFactory, set); } }
public static <T, PT extends Procedure<? super T>> void forEachInBatchWithExecutor( BatchIterable<T> batchIterable, ProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount, ForkJoinPool executor) { int size = batchIterable.size(); if (size < minForkSize || FJIterate.executedInsideOfForEach()) { PT procedure = procedureFactory.create(); batchIterable.forEach(procedure); if (combiner.useCombineOne()) { combiner.combineOne(procedure); } else { combiner.combineAll(Lists.immutable.of(procedure)); } } else { int newTaskCount = Math.min(size, Math.min(taskCount, batchIterable.getBatchCount((int) Math.ceil((double) size / (double) taskCount)))); new FJBatchIterableProcedureRunner<>(combiner, newTaskCount).executeAndCombine(executor, procedureFactory, batchIterable); } }
public static <T, PT extends Procedure<? super T>> void forEachInListOnExecutor( List<T> list, ProcedureFactory<PT> procedureFactory, Combiner<PT> combiner, int minForkSize, int taskCount, ForkJoinPool executor) { int size = list.size(); if (size < minForkSize || FJIterate.executedInsideOfForEach()) { PT procedure = procedureFactory.create(); Iterate.forEach(list, procedure); if (combiner.useCombineOne()) { combiner.combineOne(procedure); } else { combiner.combineAll(Lists.immutable.of(procedure)); } } else { int newTaskCount = Math.min(size, taskCount); new FJListProcedureRunner<>(combiner, newTaskCount).executeAndCombine(executor, procedureFactory, list); } }