public void shutdown() { for (PoolWorker w : eventLoops) { w.dispose(); } } }
@Override public Object call() { // Being Callable saves an allocation in ThreadPoolExecutor run(); return null; }
/** * Creates a ScheduledRunnable by wrapping the given action and setting * up the optional parent. * @param actual the runnable to wrap, not-null (not verified) * @param parent the parent tracking container or null if none */ public ScheduledRunnable(Runnable actual, DisposableContainer parent) { super(3); this.actual = actual; this.lazySet(0, parent); }
@Override public void run() { run.setFuture(ft); } };
FixedSchedulerPool(int maxThreads, ThreadFactory threadFactory) { // initialize event loops this.cores = maxThreads; this.eventLoops = new PoolWorker[maxThreads]; for (int i = 0; i < maxThreads; i++) { this.eventLoops[i] = new PoolWorker(threadFactory); } }
@Override public boolean isDisposed() { return get(); } }
@Override public boolean isDisposed() { Object o = get(FUTURE_INDEX); return o == DISPOSED || o == DONE; } }
@Override public final boolean isDisposed() { Future<?> f = get(); return f == FINISHED || f == DISPOSED; }
@Override public void run() { run.dispose(); } };
@Override public void run() { task.dispose(); } };
@Override public void run() { task.setFuture(ft); } };
@Override public void run() { run.setFuture(ft); } };
@Override public void run() { run.run(); } };
/** * Creates a ScheduledRunnable by wrapping the given action and setting * up the optional parent. * @param actual the runnable to wrap, not-null (not verified) * @param parent the parent tracking container or null if none */ public ScheduledRunnable(Runnable actual, DisposableContainer parent) { super(3); this.actual = actual; this.lazySet(0, parent); }
FixedSchedulerPool(int maxThreads, ThreadFactory threadFactory) { // initialize event loops this.cores = maxThreads; this.eventLoops = new PoolWorker[maxThreads]; for (int i = 0; i < maxThreads; i++) { this.eventLoops[i] = new PoolWorker(threadFactory); } }
public void shutdown() { for (PoolWorker w : eventLoops) { w.dispose(); } } }
@Override public boolean isDisposed() { return get(); } }
@Override public boolean isDisposed() { Object o = get(FUTURE_INDEX); return o == DISPOSED || o == DONE; } }
/** * Creates a ScheduledRunnable by wrapping the given action and setting * up the optional parent. * @param actual the runnable to wrap, not-null (not verified) * @param parent the parent tracking container or null if none */ public ScheduledRunnable(Runnable actual, DisposableContainer parent) { super(3); this.actual = actual; this.lazySet(0, parent); }
FixedSchedulerPool(int maxThreads, ThreadFactory threadFactory) { // initialize event loops this.cores = maxThreads; this.eventLoops = new PoolWorker[maxThreads]; for (int i = 0; i < maxThreads; i++) { this.eventLoops[i] = new PoolWorker(threadFactory); } }