Search in sources :

Example 1 with BlockingThreadPoolExecutorFactory

use of org.infinispan.commons.executors.BlockingThreadPoolExecutorFactory in project wildfly by wildfly.

the class ThreadPoolBuilder method configure.

@Override
public Builder<ThreadPoolConfiguration> configure(OperationContext context, ModelNode model) throws OperationFailedException {
    ThreadPoolExecutorFactory<?> factory = new BlockingThreadPoolExecutorFactory(this.definition.getMaxThreads().resolveModelAttribute(context, model).asInt(), this.definition.getMinThreads().resolveModelAttribute(context, model).asInt(), this.definition.getQueueLength().resolveModelAttribute(context, model).asInt(), this.definition.getKeepAliveTime().resolveModelAttribute(context, model).asLong()) {

        @Override
        public ExecutorService createExecutor(ThreadFactory factory) {
            return super.createExecutor(new ClassLoaderThreadFactory(factory, ClassLoaderThreadFactory.class.getClassLoader()));
        }
    };
    this.builder.threadPoolFactory(factory);
    return this;
}
Also used : ClassLoaderThreadFactory(org.wildfly.clustering.service.concurrent.ClassLoaderThreadFactory) ThreadFactory(java.util.concurrent.ThreadFactory) BlockingThreadPoolExecutorFactory(org.infinispan.commons.executors.BlockingThreadPoolExecutorFactory) ClassLoaderThreadFactory(org.wildfly.clustering.service.concurrent.ClassLoaderThreadFactory)

Aggregations

ThreadFactory (java.util.concurrent.ThreadFactory)1 BlockingThreadPoolExecutorFactory (org.infinispan.commons.executors.BlockingThreadPoolExecutorFactory)1 ClassLoaderThreadFactory (org.wildfly.clustering.service.concurrent.ClassLoaderThreadFactory)1