@Override public synchronized void start(StartContext context) throws StartException { pongRequestHandler.resetConnectionId(); slaveRequestExecutor = new ThreadPoolExecutor(1, Integer.MAX_VALUE, 5L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), threadFactory); super.start(context); }
@Override public synchronized void stop(StopContext context) { slaveRequestExecutor.shutdown(); super.stop(context); }
/** * Set up the services to create a channel listener and operation handler service. * @param serviceTarget the service target to install the services into * @param endpointName the endpoint name to install the services into * @param channelName the name of the channel * @param executorServiceName service name of the executor service to use in the operation handler service * @param scheduledExecutorServiceName service name of the scheduled executor service to use in the operation handler service */ public static void installManagementChannelServices( final ServiceTarget serviceTarget, final ServiceName endpointName, final AbstractModelControllerOperationHandlerFactoryService operationHandlerService, final ServiceName modelControllerName, final String channelName, final ServiceName executorServiceName, final ServiceName scheduledExecutorServiceName) { final OptionMap options = OptionMap.EMPTY; final ServiceName operationHandlerName = endpointName.append(channelName).append(ModelControllerClientOperationHandlerFactoryService.OPERATION_HANDLER_NAME_SUFFIX); serviceTarget.addService(operationHandlerName, operationHandlerService) .addDependency(modelControllerName, ModelController.class, operationHandlerService.getModelControllerInjector()) .addDependency(executorServiceName, ExecutorService.class, operationHandlerService.getExecutorInjector()) .addDependency(scheduledExecutorServiceName, ScheduledExecutorService.class, operationHandlerService.getScheduledExecutorInjector()) .setInitialMode(ACTIVE) .install(); installManagementChannelOpenListenerService(serviceTarget, endpointName, channelName, operationHandlerName, options, false); }
/** {@inheritDoc} */ @Override public synchronized void start(StartContext context) throws StartException { SERVER_MANAGEMENT_LOGGER.debugf("Starting operation handler service %s", context.getController().getName()); if(executor.getOptionalValue() == null) { // Create the default executor final BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>(WORK_QUEUE_SIZE); final ThreadFactory threadFactory = new JBossThreadFactory(new ThreadGroup(getThreadGroupName()), Boolean.FALSE, null, "%G - %t", null, null, AccessController.getContext()); final ThreadPoolExecutor executorService = new ThreadPoolExecutor(POOL_CORE_SIZE, POOL_MAX_SIZE, 60L, TimeUnit.SECONDS, workQueue, threadFactory); // Allow the core threads to time out as well executorService.allowCoreThreadTimeOut(true); getExecutorInjector().inject(executorService); } }
/** * Set up the services to create a channel listener and operation handler service. * * @param serviceTarget the service target to install the services into * @param endpointName the endpoint name to install the services into * @param channelName the name of the channel * @param verificationHandler * @param newControllers list to add the new services to */ public static void installManagementChannelServices( final ServiceTarget serviceTarget, final ServiceName endpointName, final AbstractModelControllerOperationHandlerFactoryService operationHandlerService, final ServiceName modelControllerName, final String channelName, final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) { final OptionMap options = OptionMap.create(RemotingOptions.RECEIVE_WINDOW_SIZE, ProtocolChannelClient.Configuration.WINDOW_SIZE, RemotingOptions.TRANSMIT_WINDOW_SIZE, ProtocolChannelClient.Configuration.WINDOW_SIZE); final ServiceName operationHandlerName = endpointName.append(channelName).append(ModelControllerClientOperationHandlerFactoryService.OPERATION_HANDLER_NAME_SUFFIX); final ServiceBuilder<?> builder = serviceTarget.addService(operationHandlerName, operationHandlerService) .addDependency(modelControllerName, ModelController.class, operationHandlerService.getModelControllerInjector()) .setInitialMode(ACTIVE); addController(newControllers, verificationHandler, builder); installManagementChannelOpenListenerService(serviceTarget, endpointName, channelName, operationHandlerName, options, verificationHandler, newControllers, false); }
@Override public synchronized void start(StartContext context) throws StartException { pongRequestHandler.resetConnectionId(); super.start(context); }
@Override public synchronized void start(StartContext context) throws StartException { pongRequestHandler.resetConnectionId(); super.start(context); }