Search in sources :

Example 1 with LazyThreadFactory

use of org.jgroups.util.LazyThreadFactory 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();
}
Also used : DefaultThreadFactory(org.jgroups.util.DefaultThreadFactory) LazyThreadFactory(org.jgroups.util.LazyThreadFactory)

Example 2 with LazyThreadFactory

use of org.jgroups.util.LazyThreadFactory 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));
    }
}
Also used : DefaultThreadFactory(org.jgroups.util.DefaultThreadFactory) LazyThreadFactory(org.jgroups.util.LazyThreadFactory) TP(org.jgroups.protocols.TP)

Example 3 with LazyThreadFactory

use of org.jgroups.util.LazyThreadFactory in project wildfly by wildfly.

the class TimerFactoryBuilder method build.

@Override
public ServiceBuilder<TimerFactory> build(ServiceTarget target) {
    ThreadFactory threadFactory = new ClassLoaderThreadFactory(new LazyThreadFactory(this.getThreadGroupPrefix(), true, true), JChannelFactory.class.getClassLoader());
    TimerFactory factory = () -> new TimeScheduler3(threadFactory, this.getMinThreads(), this.getMaxThreads(), this.getKeepAliveTime(), this.getQueueLength(), "abort");
    return target.addService(this.getServiceName(), new ValueService<>(new ImmediateValue<>(factory)));
}
Also used : ClassLoaderThreadFactory(org.jboss.as.clustering.jgroups.ClassLoaderThreadFactory) ThreadFactory(org.jgroups.util.ThreadFactory) LazyThreadFactory(org.jgroups.util.LazyThreadFactory) LazyThreadFactory(org.jgroups.util.LazyThreadFactory) JChannelFactory(org.jboss.as.clustering.jgroups.JChannelFactory) TimeScheduler3(org.jgroups.util.TimeScheduler3) ClassLoaderThreadFactory(org.jboss.as.clustering.jgroups.ClassLoaderThreadFactory) ImmediateValue(org.jboss.msc.value.ImmediateValue)

Aggregations

LazyThreadFactory (org.jgroups.util.LazyThreadFactory)3 DefaultThreadFactory (org.jgroups.util.DefaultThreadFactory)2 ClassLoaderThreadFactory (org.jboss.as.clustering.jgroups.ClassLoaderThreadFactory)1 JChannelFactory (org.jboss.as.clustering.jgroups.JChannelFactory)1 ImmediateValue (org.jboss.msc.value.ImmediateValue)1 TP (org.jgroups.protocols.TP)1 ThreadFactory (org.jgroups.util.ThreadFactory)1 TimeScheduler3 (org.jgroups.util.TimeScheduler3)1