executor = new JBossThreadPoolExecutor(maxThreads, maxThreads, keepAlive.getDuration(), keepAlive.getUnit(), new LinkedBlockingQueue<Runnable>(), threadFactoryValue.getValue());
value = JBossExecutors.protectedExecutorService(executor);
}
public synchronized void stop(final StopContext context) {
final JBossThreadPoolExecutor executor = this.executor;
if (executor == null) {
throw new IllegalStateException();
}
context.asynchronous();
executor.shutdown();
executor.addShutdownListener(new EventListener<StopContext>() {
public void handleEvent(final StopContext stopContext) {
stopContext.complete();
}
}, context);
this.executor = null;