Search in sources :

Example 1 with ServiceProviderRegistry

use of org.wildfly.clustering.provider.ServiceProviderRegistry in project wildfly by wildfly.

the class CacheServiceProviderRegistryServiceConfigurator method build.

@Override
public ServiceBuilder<?> build(ServiceTarget target) {
    ServiceBuilder<?> builder = new AsyncServiceConfigurator(this.getServiceName()).build(target);
    Consumer<ServiceProviderRegistry<T>> registry = new CompositeDependency(this.cache, this.dispatcherFactory, this.group).register(builder).provides(this.getServiceName());
    Service service = new FunctionalService<>(registry, Functions.identity(), this, Consumers.close());
    return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
Also used : FunctionalService(org.wildfly.clustering.service.FunctionalService) ServiceProviderRegistry(org.wildfly.clustering.provider.ServiceProviderRegistry) AsyncServiceConfigurator(org.wildfly.clustering.service.AsyncServiceConfigurator) FunctionalService(org.wildfly.clustering.service.FunctionalService) Service(org.jboss.msc.Service) CompositeDependency(org.wildfly.clustering.service.CompositeDependency)

Example 2 with ServiceProviderRegistry

use of org.wildfly.clustering.provider.ServiceProviderRegistry in project wildfly by wildfly.

the class LocalServiceProviderRegistryServiceConfigurator method build.

@Override
public ServiceBuilder<?> build(ServiceTarget target) {
    ServiceBuilder<?> builder = target.addService(this.getServiceName());
    Consumer<ServiceProviderRegistry<T>> registry = this.group.register(builder).provides(this.getServiceName());
    Service service = new FunctionalService<>(registry, Function.identity(), this);
    return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
Also used : FunctionalService(org.wildfly.clustering.service.FunctionalService) ServiceProviderRegistry(org.wildfly.clustering.provider.ServiceProviderRegistry) FunctionalService(org.wildfly.clustering.service.FunctionalService) Service(org.jboss.msc.Service)

Aggregations

Service (org.jboss.msc.Service)2 ServiceProviderRegistry (org.wildfly.clustering.provider.ServiceProviderRegistry)2 FunctionalService (org.wildfly.clustering.service.FunctionalService)2 AsyncServiceConfigurator (org.wildfly.clustering.service.AsyncServiceConfigurator)1 CompositeDependency (org.wildfly.clustering.service.CompositeDependency)1