Search in sources :

Example 11 with StopContext

use of org.jboss.msc.service.StopContext in project wildfly by wildfly.

the class ServiceBasedNamingStoreTestCase method bindObject.

private void bindObject(final ServiceName serviceName, final Object value) throws Exception {
    final CountDownLatch latch = new CountDownLatch(1);
    container.addService(serviceName, new Service<ManagedReferenceFactory>() {

        public void start(StartContext context) throws StartException {
            store.add(serviceName);
            latch.countDown();
        }

        public void stop(StopContext context) {
        }

        public ManagedReferenceFactory getValue() throws IllegalStateException, IllegalArgumentException {
            return new ValueManagedReferenceFactory(Values.immediateValue(value));
        }
    }).install();
    latch.await();
}
Also used : StopContext(org.jboss.msc.service.StopContext) StartContext(org.jboss.msc.service.StartContext) Service(org.jboss.msc.service.Service) CountDownLatch(java.util.concurrent.CountDownLatch)

Aggregations

StopContext (org.jboss.msc.service.StopContext)11 StartContext (org.jboss.msc.service.StartContext)10 Service (org.jboss.msc.Service)4 BinderService (org.jboss.as.naming.service.BinderService)3 Service (org.jboss.msc.service.Service)3 StartException (org.jboss.msc.service.StartException)3 File (java.io.File)2 URL (java.net.URL)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 ExecutorService (java.util.concurrent.ExecutorService)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 ManagedReferenceFactory (org.jboss.as.naming.ManagedReferenceFactory)2 ContextNames (org.jboss.as.naming.deployment.ContextNames)2 ServiceController (org.jboss.msc.service.ServiceController)2 TracerConfiguration (org.wildfly.microprofile.opentracing.smallrye.TracerConfiguration)2 IoCallback (io.undertow.io.IoCallback)1 Sender (io.undertow.io.Sender)1 HttpServerExchange (io.undertow.server.HttpServerExchange)1 Resource (io.undertow.server.handlers.resource.Resource)1 ResourceChangeListener (io.undertow.server.handlers.resource.ResourceChangeListener)1