Search in sources :

Example 1 with DelegatingServiceContainer

use of org.jboss.msc.service.DelegatingServiceContainer in project eap-additional-testsuite by jboss-set.

the class HATimerServiceActivator method activate.

@Override
public void activate(ServiceActivatorContext context) {
    log.info("HATimerService will be installed!");
    HATimerService service = new HATimerService();
    ServiceName factoryServiceName = SingletonServiceName.BUILDER.getServiceName("server", "default");
    ServiceController<?> factoryService = context.getServiceRegistry().getRequiredService(factoryServiceName);
    SingletonServiceBuilderFactory factory = (SingletonServiceBuilderFactory) factoryService.getValue();
    factory.createSingletonServiceBuilder(HATimerService.SINGLETON_SERVICE_NAME, 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)

Example 2 with DelegatingServiceContainer

use of org.jboss.msc.service.DelegatingServiceContainer in project eap-additional-testsuite by jboss-set.

the class HATimerServiceActivator4 method activate.

@Override
public void activate(ServiceActivatorContext context) {
    log.info("HATimerService 4 will be installed!");
    HATimerService4 service = new HATimerService4();
    ServiceName factoryServiceName = SingletonServiceName.BUILDER.getServiceName("server", "default");
    ServiceController<?> factoryService = context.getServiceRegistry().getRequiredService(factoryServiceName);
    SingletonServiceBuilderFactory factory = (SingletonServiceBuilderFactory) factoryService.getValue();
    factory.createSingletonServiceBuilder(HATimerService4.SINGLETON_SERVICE_NAME4, 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)

Example 3 with DelegatingServiceContainer

use of org.jboss.msc.service.DelegatingServiceContainer in project eap-additional-testsuite by jboss-set.

the class HATimerServiceActivator2 method activate.

@Override
public void activate(ServiceActivatorContext context) {
    log.info("HATimerService 2 will be installed!");
    HATimerService2 service = new HATimerService2();
    ServiceName factoryServiceName = SingletonServiceName.BUILDER.getServiceName("server", "default");
    ServiceController<?> factoryService = context.getServiceRegistry().getRequiredService(factoryServiceName);
    SingletonServiceBuilderFactory factory = (SingletonServiceBuilderFactory) factoryService.getValue();
    factory.createSingletonServiceBuilder(HATimerService2.SINGLETON_SERVICE_NAME2, 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)

Example 4 with DelegatingServiceContainer

use of org.jboss.msc.service.DelegatingServiceContainer 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

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 NamePreference (org.wildfly.clustering.singleton.election.NamePreference)4 PreferredSingletonElectionPolicy (org.wildfly.clustering.singleton.election.PreferredSingletonElectionPolicy)4 SimpleSingletonElectionPolicy (org.wildfly.clustering.singleton.election.SimpleSingletonElectionPolicy)4