Search in sources :

Example 1 with NodeService

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

the class SingletonServiceActivator method install.

private static void install(ServiceTarget target, SingletonServiceBuilderFactory factory, ServiceName name, String preferredNode) {
    InjectedValue<Group> group = new InjectedValue<>();
    NodeService service = new NodeService(group);
    factory.createSingletonServiceBuilder(name, service).electionPolicy(new PreferredSingletonElectionPolicy(new SimpleSingletonElectionPolicy(), new NamePreference(preferredNode))).build(target).addDependency(ServiceName.JBOSS.append("clustering", "group", "default"), Group.class, group).install();
}
Also used : InjectedValue(org.jboss.msc.value.InjectedValue) Group(org.wildfly.clustering.group.Group) NamePreference(org.wildfly.clustering.singleton.election.NamePreference) NodeService(org.jboss.as.test.clustering.cluster.singleton.service.NodeService) SimpleSingletonElectionPolicy(org.wildfly.clustering.singleton.election.SimpleSingletonElectionPolicy) PreferredSingletonElectionPolicy(org.wildfly.clustering.singleton.election.PreferredSingletonElectionPolicy)

Aggregations

NodeService (org.jboss.as.test.clustering.cluster.singleton.service.NodeService)1 InjectedValue (org.jboss.msc.value.InjectedValue)1 Group (org.wildfly.clustering.group.Group)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