@Test public void testGenerateDefaultExecutor() { ExecutorService generatedExecutor = ThreadsWorker.generateExecutor(1, null); assertNotNull(generatedExecutor); }
public static ExecutorService generateExecutor(int threads, final String poolName) { final ThreadFactory threadFactory; if (poolName == null) { threadFactory = Executors.defaultThreadFactory(); } else { threadFactory = new ThreadFactoryBuilder().setNameFormat(poolName + "-%d").build(); } return new ThreadPoolExecutor(threads, threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), threadFactory) { @Override protected void afterExecute(Runnable runnable, Throwable throwable) { super.afterExecute(runnable, throwable); if (Objects.nonNull(throwable)) { LOG.debug("Task {} failed with {}", runnable, throwable); } } }; }
ThreadsWorker implements AutoCloseable { public static ExecutorService generateExecutor(int threads, final String poolName) { final ThreadFactory threadFactory; if (poolName == null) { threadFactory = Executors.defaultThreadFactory(); } else { threadFactory = new ThreadFactoryBuilder().setNameFormat(poolName + "-%d").build(); } return new ThreadPoolExecutor(threads, threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), threadFactory) { @Override protected void afterExecute(Runnable runnable, Throwable throwable) { super.afterExecute(runnable, throwable); if (Objects.nonNull(throwable)) { LOG.debug("Task {} failed with {}", runnable, throwable); } } }; } }
ThreadsWorker implements AutoCloseable { public static ExecutorService generateExecutor(int threads, final String poolName) { final ThreadFactory threadFactory; if (poolName == null) { threadFactory = Executors.defaultThreadFactory(); } else { threadFactory = new ThreadFactoryBuilder().setNameFormat(poolName + "-%d").build(); } return new ThreadPoolExecutor(threads, threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), threadFactory) { @Override protected void afterExecute(Runnable runnable, Throwable throwable) { super.afterExecute(runnable, throwable); if (Objects.nonNull(throwable)) { LOG.debug("Task {} failed with {}", runnable, throwable); } } }; } ThreadsWorker(ScheduledExecutorService scheduledExecutorService, ExecutorService defaultExecutorService,
            ExecutorService executorServiceInbound, ExecutorService executorServiceOutbound);  ThreadsWorker();  ThreadsWorker(int inPool, int defaultPool, int outPool, int timers); }
ThreadsWorker implements AutoCloseable { public static ExecutorService generateExecutor(int threads, final String poolName) { final ThreadFactory threadFactory; if (poolName == null) { threadFactory = Executors.defaultThreadFactory(); } else { threadFactory = new ThreadFactoryBuilder().setNameFormat(poolName + "-%d").build(); } return new ThreadPoolExecutor(threads, threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), threadFactory) { @Override protected void afterExecute(Runnable runnable, Throwable throwable) { super.afterExecute(runnable, throwable); if (Objects.nonNull(throwable)) { LOG.debug("Task {} failed with {}", runnable, throwable); } } }; } 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 static ExecutorService generateExecutor(int threads, final String poolName) { final ThreadFactory threadFactory; if (poolName == null) { threadFactory = Executors.defaultThreadFactory(); } else { threadFactory = new ThreadFactoryBuilder().setNameFormat(poolName + "-%d").build(); } return new ThreadPoolExecutor(threads, threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), threadFactory) { @Override protected void afterExecute(Runnable runnable, Throwable throwable) { super.afterExecute(runnable, throwable); if (Objects.nonNull(throwable)) { LOG.debug("Task {} failed with {}", runnable, throwable); } } }; } 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();  }