@Test public void testCancelTasksInSequence() throws Exception { final int[] monitor = {0, 0}; worker.executeTaskInSequence((Callable<Void>) () -> { for (; monitor != null; ) { } return null; }, ThreadsWorker.WorkerType.INBOUND); worker.executeTaskInSequence((Callable<Void>) () -> { synchronized (monitor) { monitor[0] += 40; monitor.notifyAll(); } return null; }, ThreadsWorker.WorkerType.INBOUND); worker.cancelTasksInSequence(true, ThreadsWorker.WorkerType.INBOUND); assertEquals(0, monitor[0]); worker.executeTaskInSequence((Callable<Void>) () -> { synchronized (monitor) { monitor[1] += 80; monitor.notifyAll(); } return null; }, ThreadsWorker.WorkerType.INBOUND); synchronized (monitor) { monitor.wait(5000L); } assertEquals(0, monitor[0]); assertEquals(80, monitor[1]); }
public void cancelTasksInSequence(final boolean mayInterruptIfRunning, final WorkerType type) { cancelTasksInSequence(mayInterruptIfRunning, new QueueKey(type)); }
ThreadsWorker implements AutoCloseable { public void cancelTasksInSequence(final boolean mayInterruptIfRunning, final WorkerType type) { cancelTasksInSequence(mayInterruptIfRunning, new QueueKey(type)); } }
ThreadsWorker implements AutoCloseable { public void cancelTasksInSequence(final boolean mayInterruptIfRunning, final WorkerType type) { cancelTasksInSequence(mayInterruptIfRunning, new QueueKey(type)); } ThreadsWorker(ScheduledExecutorService scheduledExecutorService, ExecutorService defaultExecutorService,
            ExecutorService executorServiceInbound, ExecutorService executorServiceOutbound);  ThreadsWorker();  ThreadsWorker(int inPool, int defaultPool, int outPool, int timers); }
ThreadsWorker implements AutoCloseable { public void cancelTasksInSequence(final boolean mayInterruptIfRunning, final WorkerType type) { cancelTasksInSequence(mayInterruptIfRunning, new QueueKey(type)); } ThreadsWorker(ScheduledExecutorService scheduledExecutorService, ExecutorService defaultExecutorService,
            ExecutorService executorServiceInbound, ExecutorService executorServiceOutbound);  ThreadsWorker();  ThreadsWorker(int inPool, int defaultPool, int outPool, int timers); ListenableScheduledFuture<T> scheduleTask(Callable<T> task, int period, TimeUnit unit); ListenableFuture<T> executeTask(Callable<T> task, WorkerType type); ListenableFuture<T> executeTaskInSequence(final Callable<T> task, final WorkerType type); ListenableFuture<T> executeTaskInSequence(final Callable<T> task, final WorkerType type,
            final SxpConnection connection); void cancelTasksInSequence(final boolean mayInterruptIfRunning, final WorkerType type); void cancelTasksInSequence(final boolean mayInterruptIfRunning, final WorkerType type,
            final SxpConnection connection); ListenableFuture executeTask(Runnable task, WorkerType type); void addListener(ListenableFuture task, Runnable listener); static ExecutorService generateExecutor(int threads, final String poolName); static ScheduledExecutorService generateScheduledExecutor(int threads, final String poolName); ListeningExecutorService getDefaultExecutorService(); @Override void close(); }
ThreadsWorker implements AutoCloseable { public void cancelTasksInSequence(final boolean mayInterruptIfRunning, final WorkerType type) { cancelTasksInSequence(mayInterruptIfRunning, new QueueKey(type)); } ThreadsWorker(ScheduledExecutorService scheduledExecutorService, ExecutorService defaultExecutorService,
            ExecutorService executorServiceInbound, ExecutorService executorServiceOutbound);  ThreadsWorker();  ThreadsWorker(int inPool, int defaultPool, int outPool, int timers); ListenableScheduledFuture<T> scheduleTask(Callable<T> task, int period, TimeUnit unit); ListenableFuture<T> executeTask(Callable<T> task, WorkerType type); ListenableFuture<T> executeTaskInSequence(final Callable<T> task, final WorkerType type); ListenableFuture<T> executeTaskInSequence(final Callable<T> task, final WorkerType type,
            final SxpConnection connection); void cancelTasksInSequence(final boolean mayInterruptIfRunning, final WorkerType type); void cancelTasksInSequence(final boolean mayInterruptIfRunning, final WorkerType type,
            final SxpConnection connection); ListenableFuture executeTask(Runnable task, WorkerType type); void addListener(ListenableFuture task, Runnable listener); static ExecutorService generateExecutor(int threads, final String poolName); static ScheduledExecutorService generateScheduledExecutor(int threads, final String poolName); ListeningExecutorService getDefaultExecutorService(); @Override void close();  }