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();
}
Aggregations