/** * Set up the services to create a channel listener. This assumes that an endpoint service called {@code endpointName} exists. * @param serviceTarget the service target to install the services into * @param endpointName the name of the endpoint to install a channel listener into * @param channelName the name of the channel * @param operationHandlerName the name of the operation handler to handle request for this channel * @param options the remoting options * @param onDemand whether to install the services on demand */ public static void installManagementChannelOpenListenerService( final ServiceTarget serviceTarget, final ServiceName endpointName, final String channelName, final ServiceName operationHandlerName, final OptionMap options, final boolean onDemand) { final ManagementChannelOpenListenerService channelOpenListenerService = new ManagementChannelOpenListenerService(channelName, options); final ServiceBuilder<?> builder = serviceTarget.addService(channelOpenListenerService.getServiceName(endpointName), channelOpenListenerService) .addDependency(endpointName, Endpoint.class, channelOpenListenerService.getEndpointInjector()) .addDependency(operationHandlerName, ManagementChannelInitialization.class, channelOpenListenerService.getOperationHandlerInjector()) .addDependency(ManagementChannelRegistryService.SERVICE_NAME, ManagementChannelRegistryService.class, channelOpenListenerService.getRegistry()) .addDependency(SHUTDOWN_EXECUTOR_NAME, ExecutorService.class, channelOpenListenerService.getExecutorServiceInjectedValue()) .setInitialMode(onDemand ? ON_DEMAND : ACTIVE); builder.install(); }
/** * Set up the services to create a channel listener. This assumes that an endpoint service called {@code endpointName} exists. * * @param serviceTarget the service target to install the services into * @param endpointName the name of the endpoint to install a channel listener into * @param channelName the name of the channel * @param operationHandlerName the name of the operation handler to handle request for this channel * @param options the remoting options * @param verificationHandler * @param newControllers list to add the new services to * @param onDemand whether to install the services on demand */ public static void installManagementChannelOpenListenerService( final ServiceTarget serviceTarget, final ServiceName endpointName, final String channelName, final ServiceName operationHandlerName, final OptionMap options, final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers, final boolean onDemand) { final ManagementChannelOpenListenerService channelOpenListenerService = new ManagementChannelOpenListenerService(channelName, options); final ServiceBuilder<?> builder = serviceTarget.addService(channelOpenListenerService.getServiceName(endpointName), channelOpenListenerService) .addDependency(endpointName, Endpoint.class, channelOpenListenerService.getEndpointInjector()) .addDependency(operationHandlerName, ManagementChannelInitialization.class, channelOpenListenerService.getOperationHandlerInjector()) .addDependency(ManagementChannelRegistryService.SERVICE_NAME, ManagementChannelRegistryService.class, channelOpenListenerService.getRegistry()) .setInitialMode(onDemand ? ON_DEMAND : ACTIVE); addController(newControllers, verificationHandler, builder); }