/** * * @param taskExecutor the taskExecutor to set */ public void setTaskExecutor(Executor taskExecutor) { if (taskExecutor instanceof CompositeExecutor) { this.taskExecutor = (CompositeExecutor) taskExecutor; } else { this.taskExecutor = new CompositeExecutor(taskExecutor, taskExecutor); } }
if (this.taskExecutor == null) { ExecutorService executor = Executors.newCachedThreadPool(); this.taskExecutor = new CompositeExecutor(executor, executor);
/** * * @param taskExecutor the taskExecutor to set */ public void setTaskExecutor(Executor taskExecutor) { if (taskExecutor instanceof CompositeExecutor) { this.taskExecutor = (CompositeExecutor) taskExecutor; } else { this.taskExecutor = new CompositeExecutor(taskExecutor, taskExecutor); } }
private CompositeExecutor compositeExecutor() { ThreadPoolTaskExecutor ioExec = new ThreadPoolTaskExecutor(); ioExec.setCorePoolSize(2); ioExec.setMaxPoolSize(4); ioExec.setQueueCapacity(0); ioExec.setThreadNamePrefix("io-"); ioExec.setRejectedExecutionHandler(new AbortPolicy()); ioExec.initialize(); ThreadPoolTaskExecutor assemblerExec = new ThreadPoolTaskExecutor(); assemblerExec.setCorePoolSize(2); assemblerExec.setMaxPoolSize(5); assemblerExec.setQueueCapacity(0); assemblerExec.setThreadNamePrefix("assembler-"); assemblerExec.setRejectedExecutionHandler(new AbortPolicy()); assemblerExec.initialize(); return new CompositeExecutor(ioExec, assemblerExec); }
if (this.taskExecutor == null) { ExecutorService executor = Executors.newCachedThreadPool(); this.taskExecutor = new CompositeExecutor(executor, executor);