Search in sources :

Example 1 with NonBlockingThreadPoolExecutorFactory

use of org.infinispan.factories.threads.NonBlockingThreadPoolExecutorFactory in project infinispan by infinispan.

the class NettyEventLoopFactory method construct.

@Override
public Object construct(String componentName) {
    ThreadFactory threadFactory = globalConfiguration.nonBlockingThreadPool().threadFactory();
    if (threadFactory == null) {
        threadFactory = new NonBlockingThreadFactory("ISPN-non-blocking-thread-group", getDefaultThreadPrio(KnownComponentNames.NON_BLOCKING_EXECUTOR), DefaultThreadFactory.DEFAULT_PATTERN, globalConfiguration.transport().nodeName(), shortened(KnownComponentNames.NON_BLOCKING_EXECUTOR));
    }
    ThreadPoolExecutorFactory<?> tpef = globalConfiguration.nonBlockingThreadPool().threadPoolFactory();
    int threadAmount = tpef instanceof NonBlockingThreadPoolExecutorFactory ? ((NonBlockingThreadPoolExecutorFactory) tpef).maxThreads() : getDefaultThreads(KnownComponentNames.NON_BLOCKING_EXECUTOR);
    // which means the non blocking executor may have an unbounded queue, depending upon netty implementation
    return new NonRecursiveEventLoopGroup(buildEventLoop(threadAmount, threadFactory, "non-blocking-thread-netty"));
}
Also used : DefaultThreadFactory(org.infinispan.factories.threads.DefaultThreadFactory) NonBlockingThreadFactory(org.infinispan.factories.threads.NonBlockingThreadFactory) ThreadFactory(java.util.concurrent.ThreadFactory) NonBlockingThreadPoolExecutorFactory(org.infinispan.factories.threads.NonBlockingThreadPoolExecutorFactory) NonBlockingThreadFactory(org.infinispan.factories.threads.NonBlockingThreadFactory) NonRecursiveEventLoopGroup(org.infinispan.server.core.transport.NonRecursiveEventLoopGroup)

Aggregations

ThreadFactory (java.util.concurrent.ThreadFactory)1 DefaultThreadFactory (org.infinispan.factories.threads.DefaultThreadFactory)1 NonBlockingThreadFactory (org.infinispan.factories.threads.NonBlockingThreadFactory)1 NonBlockingThreadPoolExecutorFactory (org.infinispan.factories.threads.NonBlockingThreadPoolExecutorFactory)1 NonRecursiveEventLoopGroup (org.infinispan.server.core.transport.NonRecursiveEventLoopGroup)1