use of org.jgroups.util.DefaultThreadFactory in project geode by apache.
the class Transport method init.
/*
* (non-Javadoc) JGroups does not currently (3.6.6) allow you to specify that threads should be
* daemon, so we override the init() method here and create the factories before initializing UDP
*
* @see org.jgroups.protocols.UDP#init()
*/
@Override
public void init() throws Exception {
global_thread_factory = new DefaultThreadFactory("Geode ", true);
timer_thread_factory = new LazyThreadFactory(THREAD_POOL_NAME_PREFIX + " Timer", true, true);
default_thread_factory = new DefaultThreadFactory(THREAD_POOL_NAME_PREFIX + " Incoming", true, true);
oob_thread_factory = new DefaultThreadFactory(THREAD_POOL_NAME_PREFIX + " OOB", true, true);
internal_thread_factory = new DefaultThreadFactory(THREAD_POOL_NAME_PREFIX + " INT", true, true);
super.init();
}
use of org.jgroups.util.DefaultThreadFactory in project wildfly by wildfly.
the class TransportConfigurator method afterCreation.
@Override
public void afterCreation(Protocol protocol) throws Exception {
if (protocol instanceof TP) {
TP transport = (TP) protocol;
ClassLoader loader = JChannelFactory.class.getClassLoader();
transport.setThreadFactory(new ClassLoaderThreadFactory(new DefaultThreadFactory("", false), loader));
transport.setTimerThreadFactory(new ClassLoaderThreadFactory(new LazyThreadFactory("Timer", true, true), loader));
transport.setDefaultThreadPoolThreadFactory(new ClassLoaderThreadFactory(new DefaultThreadFactory("Incoming", false, true), loader));
transport.setOOBThreadPoolThreadFactory(new ClassLoaderThreadFactory(new DefaultThreadFactory("OOB", false, true), loader));
transport.setInternalThreadPoolThreadFactory(new ClassLoaderThreadFactory(new DefaultThreadFactory("INT", false, true), loader));
}
}
use of org.jgroups.util.DefaultThreadFactory in project wildfly by wildfly.
the class TransportConfigurationBuilder method accept.
@Override
public void accept(T protocol) {
InetSocketAddress socketAddress = this.getSocketBinding().getSocketAddress();
protocol.setBindAddress(socketAddress.getAddress());
protocol.setBindPort(socketAddress.getPort());
protocol.setThreadFactory(new ClassLoaderThreadFactory(new DefaultThreadFactory("", false), JChannelFactory.class.getClassLoader()));
protocol.setDefaultThreadPool(this.threadPoolFactories.get(ThreadPoolResourceDefinition.DEFAULT).getValue().get());
protocol.setInternalThreadPool(this.threadPoolFactories.get(ThreadPoolResourceDefinition.INTERNAL).getValue().get());
protocol.setOOBThreadPool(this.threadPoolFactories.get(ThreadPoolResourceDefinition.OOB).getValue().get());
protocol.setTimer(this.timerFactory.getValue().get());
Optional<InetSocketAddress> diagnosticsSocketAddress = Optional.ofNullable(this.diagnosticsSocketBinding).map(Value::getValue).map(SocketBinding::getSocketAddress);
protocol.setValue("enable_diagnostics", diagnosticsSocketAddress.isPresent());
diagnosticsSocketAddress.ifPresent(address -> {
protocol.setValue("diagnostics_addr", address.getAddress());
protocol.setValue("diagnostics_port", address.getPort());
});
}
use of org.jgroups.util.DefaultThreadFactory in project wildfly by wildfly.
the class ThreadPoolFactoryBuilder method build.
@Override
public ServiceBuilder<ThreadPoolFactory> build(ServiceTarget target) {
int queueLength = this.getQueueLength();
BlockingQueue<Runnable> queue = (queueLength > 0) ? new ArrayBlockingQueue<>(queueLength) : new SynchronousQueue<>();
ClassLoader loader = JChannelFactory.class.getClassLoader();
ThreadFactory threadFactory = new ClassLoaderThreadFactory(new DefaultThreadFactory(this.getThreadGroupPrefix(), false, true), loader);
RejectedExecutionHandler handler = new ShutdownRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
ThreadPoolFactory factory = () -> new ThreadPoolExecutor(this.getMinThreads(), this.getMaxThreads(), this.getKeepAliveTime(), TimeUnit.MILLISECONDS, queue, threadFactory, handler);
return target.addService(this.getServiceName(), new ValueService<>(new ImmediateValue<>(factory)));
}
Aggregations