use of org.jboss.as.controller.remote.ModelControllerClientOperationHandler in project wildfly-core by wildfly.
the class ModelControllerClientTestCase method setupTestClient.
private ModelControllerClient setupTestClient(final ModelController controller) throws IOException {
try {
channels.setupRemoting(new ManagementChannelInitialization() {
@Override
public ManagementChannelHandler startReceiving(Channel channel) {
final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel);
final ManagementChannelHandler support = new ManagementChannelHandler(strategy, channels.getExecutorService());
support.addHandlerFactory(new ModelControllerClientOperationHandler(controller, support, new ResponseAttachmentInputStreamSupport(), getClientRequestExecutor()));
channel.receiveMessage(support.getReceiver());
return support;
}
private ExecutorService getClientRequestExecutor() {
final BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>(512);
final ThreadFactory threadFactory = doPrivileged(new PrivilegedAction<ThreadFactory>() {
public ThreadFactory run() {
return new JBossThreadFactory(new ThreadGroup("management-handler-thread"), Boolean.FALSE, null, "%G - %t", null, null);
}
});
ThreadPoolExecutor executor = new ThreadPoolExecutor(4, 4, 250L, TimeUnit.MILLISECONDS, workQueue, threadFactory);
// Allow the core threads to time out as well
executor.allowCoreThreadTimeOut(true);
return executor;
}
});
channels.startClientConnetion();
} catch (Exception e) {
throw new RuntimeException(e);
}
final Channel clientChannel = channels.getClientChannel();
return ExistingChannelModelControllerClient.createReceiving(clientChannel, channels.getExecutorService());
}
use of org.jboss.as.controller.remote.ModelControllerClientOperationHandler in project wildfly-core by wildfly.
the class MasterDomainControllerOperationHandlerService method startReceiving.
@Override
public ManagementChannelHandler startReceiving(final Channel channel) {
DomainControllerLogger.ROOT_LOGGER.debugf("Starting receiving from a remote HostController on channel %s", channel);
final ManagementChannelHandler handler = new ManagementChannelHandler(ManagementClientChannelStrategy.create(channel), getExecutor());
handler.getAttachments().attach(ManagementChannelHandler.TEMP_DIR, tempDir);
// Assemble the request handlers for the domain channel
handler.addHandlerFactory(new HostControllerRegistrationHandler(handler, domainController, operationExecutor, getExecutor(), slaveHostRegistrations, domainHostExcludeRegistry));
handler.addHandlerFactory(new ModelControllerClientOperationHandler(getController(), handler, getResponseAttachmentSupport(), getClientRequestExecutor()));
handler.addHandlerFactory(new MasterDomainControllerOperationHandlerImpl(domainController, getExecutor()));
handler.addHandlerFactory(pongRequestHandler);
handler.addHandlerFactory(new DomainTransactionalProtocolOperationHandler(txOperationExecutor, handler, getResponseAttachmentSupport()));
channel.receiveMessage(handler.getReceiver());
return handler;
}
Aggregations