Search in sources :

Example 1 with SingletonElectionListenerService

use of org.jboss.as.test.clustering.cluster.singleton.service.SingletonElectionListenerService in project wildfly by wildfly.

the class SingletonServiceActivator method install.

private static void install(ServiceTarget target, SingletonServiceConfiguratorFactory factory, ServiceName name, String preferredNode) {
    ServiceBuilder<?> builder = target.addService(name);
    SingletonElectionListenerService listenerService = new SingletonElectionListenerService(builder.provides(name));
    builder.setInstance(listenerService).install();
    factory.createSingletonServiceConfigurator(name.append("singleton")).electionPolicy(new PreferredSingletonElectionPolicy(new SimpleSingletonElectionPolicy(), new NamePreference(preferredNode))).electionListener(listenerService).build(target).install();
}
Also used : SingletonElectionListenerService(org.jboss.as.test.clustering.cluster.singleton.service.SingletonElectionListenerService) NamePreference(org.wildfly.clustering.singleton.election.NamePreference) SimpleSingletonElectionPolicy(org.wildfly.clustering.singleton.election.SimpleSingletonElectionPolicy) PreferredSingletonElectionPolicy(org.wildfly.clustering.singleton.election.PreferredSingletonElectionPolicy)

Aggregations

SingletonElectionListenerService (org.jboss.as.test.clustering.cluster.singleton.service.SingletonElectionListenerService)1 NamePreference (org.wildfly.clustering.singleton.election.NamePreference)1 PreferredSingletonElectionPolicy (org.wildfly.clustering.singleton.election.PreferredSingletonElectionPolicy)1 SimpleSingletonElectionPolicy (org.wildfly.clustering.singleton.election.SimpleSingletonElectionPolicy)1