@Test public void testExecuteTaskInSequence_Get_Connection() throws Exception { final int[] monitor = {0, 0}; ListenableFuture future = worker.executeTaskInSequence((Callable<Void>) () -> { for (; monitor != null; ) { } return null; }, ThreadsWorker.WorkerType.INBOUND, connection); ListenableFuture future_2 = worker.executeTaskInSequence((Callable<Void>) () -> { synchronized (monitor) { monitor[0] += 40; monitor.notifyAll(); } return null; }, ThreadsWorker.WorkerType.INBOUND, connection); worker.executeTaskInSequence((Callable<Void>) () -> { synchronized (monitor) { monitor[1] += 80; monitor.notifyAll(); } return null; }, ThreadsWorker.WorkerType.INBOUND, connection); future_2.get(500L, TimeUnit.MILLISECONDS); assertEquals(40, monitor[0]); future.cancel(true); synchronized (monitor) { monitor.wait(5000L); } assertEquals(80, monitor[1]); }
public <T> ListenableFuture<T> executeTaskInSequence(final Callable<T> task, final WorkerType type) { LOG.debug("Execute in sequence task {}", Objects.requireNonNull(task).getClass()); return executeTaskInSequence(Objects.requireNonNull(task), new QueueKey(type)); }
ThreadsWorker implements AutoCloseable { public <T> ListenableFuture<T> executeTaskInSequence(final Callable<T> task, final WorkerType type) { LOG.debug("Execute in sequence task {}", Objects.requireNonNull(task).getClass()); return executeTaskInSequence(Objects.requireNonNull(task), new QueueKey(type)); } }
ThreadsWorker implements AutoCloseable { public <T> ListenableFuture<T> executeTaskInSequence(final Callable<T> task, final WorkerType type) { LOG.debug("Execute in sequence task {}", Objects.requireNonNull(task).getClass()); return executeTaskInSequence(Objects.requireNonNull(task), 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 <T> ListenableFuture<T> executeTaskInSequence(final Callable<T> task, final WorkerType type) { LOG.debug("Execute in sequence task {}", Objects.requireNonNull(task).getClass()); return executeTaskInSequence(Objects.requireNonNull(task), 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 <T> ListenableFuture<T> executeTaskInSequence(final Callable<T> task, final WorkerType type) { LOG.debug("Execute in sequence task {}", Objects.requireNonNull(task).getClass()); return executeTaskInSequence(Objects.requireNonNull(task), 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();  }