use of org.jboss.msc.service.LifecycleEvent in project wildfly by wildfly.
the class WritableServiceBasedNamingStoreTestCase method setup.
@Before
public void setup() throws Exception {
container = ServiceContainer.Factory.create();
installOwnerService(OWNER_FOO);
installOwnerService(OWNER_BAR);
final CountDownLatch latch2 = new CountDownLatch(1);
final NamingStoreService namingStoreService = new NamingStoreService();
container.addService(ContextNames.JAVA_CONTEXT_SERVICE_NAME, namingStoreService).setInitialMode(ServiceController.Mode.ACTIVE).addListener(new LifecycleListener() {
public void handleEvent(ServiceController<?> controller, LifecycleEvent event) {
switch(event) {
case UP:
{
latch2.countDown();
break;
}
case FAILED:
{
latch2.countDown();
fail("Did not install store service - " + controller.getStartException().getMessage());
break;
}
default:
break;
}
}
}).install();
latch2.await(10, TimeUnit.SECONDS);
store = (WritableServiceBasedNamingStore) namingStoreService.getValue();
}
use of org.jboss.msc.service.LifecycleEvent in project wildfly by wildfly.
the class WritableServiceBasedNamingStoreTestCase method installOwnerService.
private void installOwnerService(ServiceName owner) throws InterruptedException {
final CountDownLatch latch1 = new CountDownLatch(1);
container.addService(JndiNamingDependencyProcessor.serviceName(owner), new RuntimeBindReleaseService()).setInitialMode(ServiceController.Mode.ACTIVE).addListener(new LifecycleListener() {
public void handleEvent(ServiceController<?> controller, LifecycleEvent event) {
switch(event) {
case UP:
{
latch1.countDown();
break;
}
case FAILED:
{
latch1.countDown();
fail("Did not install store service - " + controller.getStartException().getMessage());
break;
}
default:
break;
}
}
}).install();
latch1.await(10, TimeUnit.SECONDS);
}
Aggregations