/** {@inheritDoc} */ @Override public synchronized void start(StartContext context) throws StartException { MGMT_OP_LOGGER.debugf("Starting operation handler service %s", context.getController().getName()); responseAttachmentSupport = new ResponseAttachmentInputStreamSupport(scheduledExecutor.getValue()); final ThreadFactory threadFactory = doPrivileged(new PrivilegedAction<JBossThreadFactory>() { public JBossThreadFactory run() { return new JBossThreadFactory(new ThreadGroup("management-handler-thread"), Boolean.FALSE, null, "%G - %t", null, null); } }); if (EnhancedQueueExecutor.DISABLE_HINT) { ThreadPoolExecutor executor = new ThreadPoolExecutor(POOL_CORE_SIZE, POOL_MAX_SIZE, 600L, TimeUnit.SECONDS, new LinkedBlockingDeque<>(WORK_QUEUE_SIZE), threadFactory); // Allow the core threads to time out as well executor.allowCoreThreadTimeOut(true); this.clientRequestExecutor = executor; } else { this.clientRequestExecutor = new EnhancedQueueExecutor.Builder() .setCorePoolSize(POOL_CORE_SIZE) .setMaximumPoolSize(POOL_MAX_SIZE) .setKeepAliveTime(600L, TimeUnit.SECONDS) .setMaximumQueueSize(WORK_QUEUE_SIZE) .setThreadFactory(threadFactory) .allowCoreThreadTimeOut(true) .build(); } }
/** {@inheritDoc} */ @Override public synchronized void start(StartContext context) throws StartException { MGMT_OP_LOGGER.debugf("Starting operation handler service %s", context.getController().getName()); responseAttachmentSupport = new ResponseAttachmentInputStreamSupport(scheduledExecutor.getValue()); final ThreadFactory threadFactory = doPrivileged(new PrivilegedAction<JBossThreadFactory>() { public JBossThreadFactory run() { return new JBossThreadFactory(new ThreadGroup("management-handler-thread"), Boolean.FALSE, null, "%G - %t", null, null); } }); if (EnhancedQueueExecutor.DISABLE_HINT) { ThreadPoolExecutor executor = new ThreadPoolExecutor(POOL_CORE_SIZE, POOL_MAX_SIZE, 600L, TimeUnit.SECONDS, new LinkedBlockingDeque<>(WORK_QUEUE_SIZE), threadFactory); // Allow the core threads to time out as well executor.allowCoreThreadTimeOut(true); this.clientRequestExecutor = executor; } else { this.clientRequestExecutor = new EnhancedQueueExecutor.Builder() .setCorePoolSize(POOL_CORE_SIZE) .setMaximumPoolSize(POOL_MAX_SIZE) .setKeepAliveTime(600L, TimeUnit.SECONDS) .setMaximumQueueSize(WORK_QUEUE_SIZE) .setThreadFactory(threadFactory) .allowCoreThreadTimeOut(true) .build(); } }