/** * Create a new Fiber from this pool that uses the supplied {@link Executor} to execute commands * * @param batchExecutor Executor to use for command executor. Required. * @return Fiber instance */ public Fiber create(BatchExecutor batchExecutor) { return new PoolFiber(this.executor, batchExecutor, _scheduler); }
private Disposable register(final Disposable stopper) { Disposable wrapper = new Disposable() { public void dispose() { stopper.dispose(); remove(this); } }; //scheduler is shared so tasks removed individually add(wrapper); return wrapper; } }
public Disposable scheduleAtFixedRate(Runnable command, long initialDelay, long delay, TimeUnit unit) { return register(_scheduler.scheduleAtFixedRate(command, initialDelay, delay, unit)); }
public void dispose() { stopper.dispose(); remove(this); } };
public void start() { ExecutionState state = _started.get(); if (state == ExecutionState.Running) { throw new RuntimeException("Already Started"); } if (_started.compareAndSet(state, ExecutionState.Running)) { _queue.setRunning(true); execute(new Runnable() { public void run() { //flush any pending events in execute } }); } }
public Disposable scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) { return register(_scheduler.scheduleWithFixedDelay(command, initialDelay, delay, unit)); }
public void dispose() { stopper.dispose(); remove(this); } };
public void start() { ExecutionState state = _started.get(); if (state == ExecutionState.Running) { throw new RuntimeException("Already Started"); } if (_started.compareAndSet(state, ExecutionState.Running)) { _queue.setRunning(true); execute(new Runnable() { public void run() { //flush any pending events in execute } }); } }
public Disposable scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) { return register(_scheduler.scheduleWithFixedDelay(command, initialDelay, delay, unit)); }
/** * Create a new Fiber from this pool that uses the supplied {@link Executor} to execute commands * * @param batchExecutor Executor to use for command executor. Required. * @return Fiber instance */ public Fiber create(BatchExecutor batchExecutor) { return new PoolFiber(this.executor, batchExecutor, _scheduler); }
private Disposable register(final Disposable stopper) { Disposable wrapper = new Disposable() { public void dispose() { stopper.dispose(); remove(this); } }; //scheduler is shared so tasks removed individually add(wrapper); return wrapper; } }
public Disposable scheduleAtFixedRate(Runnable command, long initialDelay, long delay, TimeUnit unit) { return register(_scheduler.scheduleAtFixedRate(command, initialDelay, delay, unit)); }