Search in sources :

Example 1 with SingletonServiceBuilderFactory

use of org.wildfly.clustering.singleton.SingletonServiceBuilderFactory in project wildfly by wildfly.

the class SingletonServiceActivator method activate.

@Override
public void activate(ServiceActivatorContext context) {
    try {
        SingletonServiceBuilderFactory factory = (SingletonServiceBuilderFactory) context.getServiceRegistry().getRequiredService(SingletonServiceName.BUILDER.getServiceName(CONTAINER_NAME)).awaitValue();
        ServiceTarget target = context.getServiceTarget();
        install(target, factory, SERVICE_A_NAME, SERVICE_A_PREFERRED_NODE);
        install(target, factory, SERVICE_B_NAME, SERVICE_B_PREFERRED_NODE);
    } catch (InterruptedException e) {
        throw new ServiceRegistryException(e);
    }
}
Also used : SingletonServiceBuilderFactory(org.wildfly.clustering.singleton.SingletonServiceBuilderFactory) ServiceTarget(org.jboss.msc.service.ServiceTarget) ServiceRegistryException(org.jboss.msc.service.ServiceRegistryException)

Example 2 with SingletonServiceBuilderFactory

use of org.wildfly.clustering.singleton.SingletonServiceBuilderFactory in project wildfly by wildfly.

the class NodeServiceActivator method activate.

@Override
public void activate(ServiceActivatorContext context) {
    ServiceTarget target = context.getServiceTarget();
    try {
        SingletonServiceBuilderFactory factory = (SingletonServiceBuilderFactory) context.getServiceRegistry().getRequiredService(ServiceName.parse(SingletonDefaultCacheRequirement.SINGLETON_SERVICE_BUILDER_FACTORY.resolve(CONTAINER_NAME))).awaitValue();
        install(target, factory, DEFAULT_SERVICE_NAME, 1);
        install(target, factory, QUORUM_SERVICE_NAME, 2);
    } catch (InterruptedException e) {
        throw new ServiceRegistryException(e);
    }
}
Also used : SingletonServiceBuilderFactory(org.wildfly.clustering.singleton.SingletonServiceBuilderFactory) ServiceTarget(org.jboss.msc.service.ServiceTarget) ServiceRegistryException(org.jboss.msc.service.ServiceRegistryException)

Aggregations

ServiceRegistryException (org.jboss.msc.service.ServiceRegistryException)2 ServiceTarget (org.jboss.msc.service.ServiceTarget)2 SingletonServiceBuilderFactory (org.wildfly.clustering.singleton.SingletonServiceBuilderFactory)2