/** * * @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 void checkForAssembler() { synchronized (this.executionControl) { if (this.executionControl.incrementAndGet() <= 1) { // only execute run() if we don't already have one running this.executionControl.set(1); if (logger.isDebugEnabled()) { logger.debug(this.getConnectionId() + " Running an assembler"); } try { this.taskExecutor.execute2(this); } catch (RejectedExecutionException e) { this.executionControl.decrementAndGet(); if (logger.isInfoEnabled()) { logger.info("Insufficient threads in the assembler fixed thread pool; consider increasing " + "this task executor pool size"); } throw e; } } else { this.executionControl.decrementAndGet(); } } }
if (this.taskExecutor == null) { ExecutorService executor = Executors.newCachedThreadPool(); this.taskExecutor = new CompositeExecutor(executor, executor);
this.taskExecutor.execute2(this);
/** * * @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 void checkForAssembler() { synchronized (this.executionControl) { if (this.executionControl.incrementAndGet() <= 1) { // only execute run() if we don't already have one running this.executionControl.set(1); if (logger.isDebugEnabled()) { logger.debug(this.getConnectionId() + " Running an assembler"); } try { this.taskExecutor.execute2(this); } catch (RejectedExecutionException e) { this.executionControl.decrementAndGet(); if (logger.isInfoEnabled()) { logger.info("Insufficient threads in the assembler fixed thread pool; consider increasing " + "this task executor pool size"); } throw e; } } else { this.executionControl.decrementAndGet(); } } }
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); }
this.taskExecutor.execute2(this);
if (this.taskExecutor == null) { ExecutorService executor = Executors.newCachedThreadPool(); this.taskExecutor = new CompositeExecutor(executor, executor);