@Override public ServiceBuilder<T> build(ServiceTarget target) { return target.addService(this.name, new ValueService<>(this.value)) .addDependency(this.targetName, this.targetClass, this.value) .setInitialMode(ServiceController.Mode.PASSIVE); } }
public static ServiceController<UserTransaction> addService(final ServiceTarget target) { ServiceBuilder<UserTransaction> serviceBuilder = target.addService(INTERNAL_SERVICE_NAME, INSTANCE); serviceBuilder.requires(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT); return serviceBuilder.install(); }
@SuppressWarnings("unchecked") private synchronized void setupComponent() { if (component == null) { component = ((ServiceController<BasicComponent>) serviceRegistry.getRequiredService(componentStartServiceName)) .getValue(); } }
private static InstancesService putIfAbsent(ServiceRegistry registry, ServiceName name, ServiceBuilder builder) throws StartException { for (; ; ) { try { ServiceController sc = registry.getService(name); if (sc == null) { sc = builder.install(); } return (InstancesService) sc.getService(); } catch (DuplicateServiceException ignored) { } catch (Exception e) { throw new StartException(e); } } }
@Override public ServiceBuilder<T> build(ServiceTarget target) { return target.addService(this.name, this).addDependency(EXECUTOR_SERVICE_NAME, ExecutorService.class, this.executor); }
@SuppressWarnings("unchecked") @Override public void start(StartContext context) throws StartException { super.start(context); ServiceRegistry registry = context.getController().getServiceContainer(); this.primaryController = (ServiceController<T>) registry.getService(this.getServiceName().append("primary")); this.backupController = (ServiceController<T>) registry.getService(this.getServiceName().append("backup")); this.started = true; }
@Override public void undeploy(DeploymentUnit context) { final ServiceName weldTransactionServiceName = context.getServiceName().append(ServiceNames.WELD_TRANSACTION_SERVICES_SERVICE_NAME); final ServiceController<?> serviceController = context.getServiceRegistry().getService(weldTransactionServiceName); if (serviceController != null) { serviceController.setMode(ServiceController.Mode.REMOVE); } }
static ModClusterService service(String name) { final ServiceContainer serviceContainer = CurrentServiceContainer.getServiceContainer(); if(serviceContainer == null) { //for tests return null; } ServiceController<?> cluster = serviceContainer.getService(UndertowService.FILTER.append(name)); if(cluster == null) { return null; } return (ModClusterService) cluster.getService(); } }
/** * Get the base service name of an application's JNDI namespace. * * @param app the application name (must not be {@code null}) * @return the base service name */ public static ServiceName contextServiceNameOfApplication(String app) { return APPLICATION_CONTEXT_SERVICE_NAME.append(app); }
@Override public void start(final StartContext startContext) throws StartException { if (IIOPLogger.ROOT_LOGGER.isDebugEnabled()) { IIOPLogger.ROOT_LOGGER.debugf("Starting service %s", startContext.getController().getName().getCanonicalName()); } }
@Override public void stop(final StopContext stopContext) { if (IIOPLogger.ROOT_LOGGER.isDebugEnabled()) { IIOPLogger.ROOT_LOGGER.debugf("Stopping service %s", stopContext.getController().getName().getCanonicalName()); } }
@Override public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) { if (event == LifecycleEvent.DOWN) { controller.setMode(Mode.ACTIVE); controller.removeListener(this); } } });
@Override public void configureDependency(final ServiceBuilder<?> serviceBuilder, ComponentStartService service) throws DeploymentUnitProcessingException { serviceBuilder.requires(serviceName); } });
@Override public void handleEvent(ServiceController<?> controller, LifecycleEvent event) { if(event == LifecycleEvent.REMOVED) { context.complete(); } } });
@Override public String toString() { return this.name.getCanonicalName(); } }
@Override public T getValue() { return this.service.getValue(); } }
public static ServiceName getConcurrentContextServiceName(String app, String module, String component) { final ServiceName moduleServiceName = CONCURRENT_CONTEXT_BASE_SERVICE_NAME.append(app).append(module); if(component == null) { return moduleServiceName; } else { return moduleServiceName.append(component); } }
@Override public void stop(StopContext context) { if (IIOPLogger.ROOT_LOGGER.isDebugEnabled()) { IIOPLogger.ROOT_LOGGER.debugf("Stopping service %s", context.getController().getName().getCanonicalName()); } }
public InfinispanRouteLocatorServiceConfigurator(String serverName, String deploymentName) { super(ServiceName.JBOSS.append("clustering", "web", "locator", deploymentName)); this.serverName = serverName; this.deploymentName = deploymentName; }
/** * Get the service name of this components create service * * @return The create service name */ public ServiceName getCreateServiceName() { return serviceName.append("CREATE"); }