Search in sources :

Example 11 with NamePreference

use of org.wildfly.clustering.singleton.election.NamePreference in project eap-additional-testsuite by jboss-set.

the class HATimerServiceActivator3 method activate.

@Override
public void activate(ServiceActivatorContext context) {
    log.info("HATimerService 3 will be installed!");
    HATimerService3 service = new HATimerService3();
    ServiceName factoryServiceName = SingletonServiceName.BUILDER.getServiceName("server", "default");
    ServiceController<?> factoryService = context.getServiceRegistry().getRequiredService(factoryServiceName);
    SingletonServiceBuilderFactory factory = (SingletonServiceBuilderFactory) factoryService.getValue();
    factory.createSingletonServiceBuilder(HATimerService3.SINGLETON_SERVICE_NAME3, service).electionPolicy(new PreferredSingletonElectionPolicy(new SimpleSingletonElectionPolicy(), new NamePreference("node1/singleton"))).build(new DelegatingServiceContainer(context.getServiceTarget(), context.getServiceRegistry())).setInitialMode(ServiceController.Mode.ACTIVE).install();
}
Also used : NamePreference(org.wildfly.clustering.singleton.election.NamePreference) SingletonServiceName(org.wildfly.clustering.singleton.SingletonServiceName) ServiceName(org.jboss.msc.service.ServiceName) SingletonServiceBuilderFactory(org.wildfly.clustering.singleton.SingletonServiceBuilderFactory) SimpleSingletonElectionPolicy(org.wildfly.clustering.singleton.election.SimpleSingletonElectionPolicy) PreferredSingletonElectionPolicy(org.wildfly.clustering.singleton.election.PreferredSingletonElectionPolicy) DelegatingServiceContainer(org.jboss.msc.service.DelegatingServiceContainer)

Aggregations

NamePreference (org.wildfly.clustering.singleton.election.NamePreference)11 PreferredSingletonElectionPolicy (org.wildfly.clustering.singleton.election.PreferredSingletonElectionPolicy)8 SimpleSingletonElectionPolicy (org.wildfly.clustering.singleton.election.SimpleSingletonElectionPolicy)8 DelegatingServiceContainer (org.jboss.msc.service.DelegatingServiceContainer)4 ServiceName (org.jboss.msc.service.ServiceName)4 SingletonServiceBuilderFactory (org.wildfly.clustering.singleton.SingletonServiceBuilderFactory)4 SingletonServiceName (org.wildfly.clustering.singleton.SingletonServiceName)4 OutboundSocketBinding (org.jboss.as.network.OutboundSocketBinding)2 InjectedValue (org.jboss.msc.value.InjectedValue)2 Group (org.wildfly.clustering.group.Group)2 Preference (org.wildfly.clustering.singleton.election.Preference)2 OutboundSocketBindingPreference (org.wildfly.extension.clustering.singleton.election.OutboundSocketBindingPreference)2 ArrayList (java.util.ArrayList)1 NodeService (org.jboss.as.test.clustering.cluster.singleton.service.NodeService)1 SingletonElectionListenerService (org.jboss.as.test.clustering.cluster.singleton.service.SingletonElectionListenerService)1 ModelNode (org.jboss.dmr.ModelNode)1 Test (org.junit.Test)1 Node (org.wildfly.clustering.group.Node)1 Dependency (org.wildfly.clustering.service.Dependency)1 InjectedValueDependency (org.wildfly.clustering.service.InjectedValueDependency)1