use of org.jboss.threads.QueueExecutor in project wildfly-core by wildfly.
the class RemoteChannelPairSetup method setupRemoting.
public void setupRemoting(final ManagementMessageHandler handler) throws IOException {
// executorService = new ThreadPoolExecutor(16, 16, 1L, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>());
ThreadFactory threadFactory = new JBossThreadFactory(new ThreadGroup("Remoting"), Boolean.FALSE, null, "Remoting %f thread %t", null, null);
executorService = new QueueExecutor(EXECUTOR_MAX_THREADS / 4 + 1, EXECUTOR_MAX_THREADS, EXECUTOR_KEEP_ALIVE_TIME, TimeUnit.MILLISECONDS, 500, threadFactory, true, null);
ChannelServer.Configuration configuration = new ChannelServer.Configuration();
configuration.setEndpointName(ENDPOINT_NAME);
configuration.setUriScheme(URI_SCHEME);
configuration.setBindAddress(new InetSocketAddress("127.0.0.1", PORT));
configuration.setExecutor(executorService);
channelServer = ChannelServer.create(configuration);
final Channel.Receiver receiver = ManagementChannelReceiver.createDelegating(handler);
this.registration = channelServer.addChannelOpenListener(TEST_CHANNEL, new OpenListener() {
@Override
public void registrationTerminated() {
}
@Override
public void channelOpened(Channel channel) {
serverChannel = channel;
serverChannel.receiveMessage(receiver);
clientConnectedLatch.countDown();
}
});
}
use of org.jboss.threads.QueueExecutor in project wildfly-core by wildfly.
the class RemoteChannelPairSetup method setupRemoting.
public void setupRemoting(final ManagementChannelInitialization initialization) throws IOException {
// executorService = Executors.newCachedThreadPool();
final ThreadFactory threadFactory = new JBossThreadFactory(new ThreadGroup("Remoting"), Boolean.FALSE, null, "Remoting %f thread %t", null, null);
executorService = new QueueExecutor(EXECUTOR_MAX_THREADS / 4 + 1, EXECUTOR_MAX_THREADS, EXECUTOR_KEEP_ALIVE_TIME, TimeUnit.MILLISECONDS, 500, threadFactory, true, null);
final ChannelServer.Configuration configuration = new ChannelServer.Configuration();
configuration.setEndpointName(ENDPOINT_NAME);
configuration.setUriScheme(URI_SCHEME);
configuration.setBindAddress(new InetSocketAddress("127.0.0.1", PORT));
configuration.setExecutor(executorService);
channelServer = ChannelServer.create(configuration);
channelServer.addChannelOpenListener(TEST_CHANNEL, new OpenListener() {
@Override
public void registrationTerminated() {
}
@Override
public void channelOpened(Channel channel) {
serverChannel = channel;
initialization.startReceiving(channel);
clientConnectedLatch.countDown();
}
});
}
use of org.jboss.threads.QueueExecutor in project wildfly-core by wildfly.
the class BoundedQueueThreadPoolService method start.
public synchronized void start(final StartContext context) throws StartException {
final TimeSpec keepAliveSpec = keepAlive;
long keepAliveTime = keepAliveSpec == null ? Long.MAX_VALUE : keepAliveSpec.getUnit().toNanos(keepAliveSpec.getDuration());
QueueExecutor queueExecutor = new QueueExecutor(coreThreads, maxThreads, keepAliveTime, TimeUnit.NANOSECONDS, queueLength, threadFactoryValue.getValue(), blocking, handoffExecutorValue.getOptionalValue());
queueExecutor.setAllowCoreThreadTimeout(allowCoreTimeout);
executor = new ManagedQueueExecutorService(queueExecutor);
}
Aggregations