@Override public void submit(J job) { preSubmit(job); processor_.submit(job); postSubmit(job); }
@Override public void process() throws InterruptedException { preProcess(); processor_.process(); postProcess(); }
@Override public final void setInterrupt(boolean flag) { this.termination_ = flag; super.setInterrupt(flag); inputProcessorFactory_.setInterrupt(flag); }
@Override public boolean isInterrupted() { if (interruptMonitor_.isInterrupted()) { interrupt(); } return isInterrupted_; }
@Test public void testWithInterrupts() { run(new TestInterrupter(new RandomInterruptMonitor(random, INTERRUPTION_CHANCE, INTERRUPTION_INTERVAL_NANOS))); }
@Override public void finish() { engine_.finish(); // System.err.println(ruleAppFactory_.getStatistics().getRuleStatistics().getTotalRuleAppCount()); }
/** * Starts the workers to process the input. * * @return {@code true} if the operation was successful */ public synchronized boolean start() { termination = false; jobMonitor = executor.submit(worker, maxWorkers); return true; }
protected synchronized void waitWorkers() throws InterruptedException { if (jobMonitor == null) { return; } // else jobMonitor.waitDone(); }
@Override public boolean isInterrupted() { return processorFactory.isInterrupted(); }
/** * Interrupting all threads of this executor (used to wake up waiting * threads if something needs to be notified) */ public void interrupt() { checkException(); threadGroup.interrupt(); }
void setup(int round, final InterruptMonitor interrupter) { int workers = random.nextInt(round + 1) + 1; factory_ = new TestInputProcessorFactory(interrupter); computation_ = new ConcurrentComputationWithInputs<Integer, TestInputProcessorFactory>( factory_, executor, workers, workers); }
/** * Create a {@link ComputationExecutor} with a given maximal number of * threads and the the given name which is used to identify threads * * @param threadCount * @param name */ public ComputationExecutor(int threadCount, String name) { this(threadCount, new ComputationThreadGroup(name)); }
/** * Starts the workers to process the input. * * @return {@code true} if the operation was successful */ public synchronized boolean start() { return executor_.start(worker_, maxWorkers_); }
@Override public void submit(J job) { preSubmit(job); processor_.submit(job); postSubmit(job); }
@Override public void process() throws InterruptedException { preProcess(); processor_.process(); postProcess(); }
@Override public void finish() { engine_.finish(); // System.err.println(ruleAppFactory_.getStatistics().getRuleStatistics().getTotalRuleAppCount()); }
@Override public void submit(J job) { preSubmit(job); processor_.submit(job); postSubmit(job); }
@Override public void process() throws InterruptedException { preProcess(); processor_.process(); postProcess(); }
@Override public void submit(J job) { preSubmit(job); processor_.submit(job); postSubmit(job); }
@Override public void process() throws InterruptedException { preProcess(); processor_.process(); postProcess(); }