use of org.infinispan.factories.threads.NonBlockingThreadFactory in project infinispan by infinispan.
the class AsyncStoreStressTest method startMarshaller.
@BeforeClass(alwaysRun = true)
void startMarshaller() {
marshaller = new TestObjectStreamMarshaller();
location = CommonsTestingUtil.tmpDirectory(this.getClass());
nonBlockingExecutor = new ThreadPoolExecutor(0, ProcessorInfo.availableProcessors() * 2, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(KnownComponentNames.getDefaultQueueSize(KnownComponentNames.NON_BLOCKING_EXECUTOR)), new NonBlockingThreadFactory("ISPN-non-blocking-thread-group", Thread.NORM_PRIORITY, DefaultThreadFactory.DEFAULT_PATTERN, "Test", "non-blocking"), NonBlockingRejectedExecutionHandler.getInstance());
blockingExecutor = new ThreadPoolExecutor(0, 150, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(KnownComponentNames.getDefaultQueueSize(KnownComponentNames.BLOCKING_EXECUTOR)), getTestThreadFactory("Blocking"), BlockingRejectedExecutionHandler.getInstance());
PerKeyLockContainer lockContainer = new PerKeyLockContainer();
TestingUtil.inject(lockContainer, new DefaultTimeService());
locks = lockContainer;
timeService = new DefaultTimeService();
TestingUtil.inject(locks, timeService, nonBlockingExecutor);
}
use of org.infinispan.factories.threads.NonBlockingThreadFactory 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"));
}
Aggregations