Examples of LifecycleManager


Examples of com.netflix.governator.lifecycle.LifecycleManager

    @Test(dataProvider = "builders")
    public void     testInjectedIntoAnother(LifecycleInjectorBuilder lifecycleInjectorBuilder) throws Exception
    {
        Injector            injector = lifecycleInjectorBuilder.usingBasePackages(PACKAGES).createInjector();
        LifecycleManager    manager = injector.getInstance(LifecycleManager.class);
        manager.start();

        SimpleContainer     instance = injector.getInstance(SimpleContainer.class);

        Assert.assertEquals(instance.simpleObject.startCount.get(), 1);
        Assert.assertEquals(instance.simpleObject.finishCount.get(), 0);

        manager.close();

        Assert.assertEquals(instance.simpleObject.startCount.get(), 1);
        Assert.assertEquals(instance.simpleObject.finishCount.get(), 1);
    }
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

public class LifecycleManagerStarter implements PostInjectorAction {
    private static final Logger log = LoggerFactory.getLogger(LifecycleManagerStarter.class);

    @Override
    public void call(Injector injector) {
        LifecycleManager manager = injector.getInstance(LifecycleManager.class);
        try {
            manager.start();
        } catch (Exception e) {
            log.error("Failed to start LifecycleManager", e);
        }
    }
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

        }
        else {
            builder = LifecycleInjector.builder();
            injector = builder.build().createInjector();
        }
        LifecycleManager manager = injector.getInstance(LifecycleManager.class);
        try {
            manager.start();
        } catch (Exception e) {
            Assert.fail(e.getMessage());
        }
        return injector;
    }
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

    /**
     * Override to tear down your specific external resource.
     */
    protected void after() {
        if (injector != null) {
            LifecycleManager manager = injector.getInstance(LifecycleManager.class);
            try {
                manager.close();
            } catch (Exception e) {
                Assert.fail(e.getMessage());
            }
        }
    }
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

            }
        );
    }

    private <T> void processInjectedObject(T obj, TypeLiteral<T> type){
        LifecycleManager manager = lifecycleManager.get();
        if ( manager != null ) {
            for ( LifecycleListener listener : manager.getListeners() ) {
                listener.objectInjected(type, obj);
            }

            Class<?> clazz = obj.getClass();
            LifecycleMethods methods = getLifecycleMethods(clazz);

            if ( warmUpIsInDag(clazz, type) ) {
                addDependencies(manager, obj, type, methods);
            }

            if ( methods.hasLifecycleAnnotations() ) {
                try {
                    manager.add(obj, methods);
                }
                catch ( Exception e ) {
                    throw new Error(e);
                }
            }
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

            else
            {
                injector = LifecycleInjector.builder().withBootstrapModule(new ParavirtualBootstrapModule()).createInjector();
            }

            LifecycleManager manager = injector.getInstance(LifecycleManager.class);

            manager.start();

            Bootstrapper bootstrapper = injector.getInstance(Bootstrapper.class);

            bootstrapper.execute();

            manager.close();
        }
        catch (Throwable t)
        {
            log.error(t.getMessage(), t);
        }
View Full Code Here

Examples of com.proofpoint.bootstrap.LifeCycleManager

                );

        Injector injector = app.initialize();

        ExecutorService executor = injector.getInstance(Key.get(ScheduledExecutorService.class, ForDiscoveryClient.class));
        LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);

        assertFalse(executor.isShutdown());
        lifeCycleManager.stop();
        assertTrue(executor.isShutdown());
    }
View Full Code Here

Examples of io.airlift.bootstrap.LifeCycleManager

                .strictConfig()
                .doNotInitializeLogging()
                .initialize();

        ExecutorService executor = injector.getInstance(Key.get(ScheduledExecutorService.class, ForDiscoveryClient.class));
        LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);

        assertFalse(executor.isShutdown());
        lifeCycleManager.stop();
        assertTrue(executor.isShutdown());
    }
View Full Code Here

Examples of javax.xml.registry.LifeCycleManager

        for (Key key : (Collection<Key>) objectKeys) {
          String keyString = key.getId();
            keys[currLoc++]=keyString;
        }
        LinkedHashSet<RegistryObject> col = new LinkedHashSet<RegistryObject>();
        LifeCycleManager lcm = registryService.getLifeCycleManagerImpl();

        if (LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType))
        {
            try
            {
View Full Code Here

Examples of javax.xml.registry.LifeCycleManager

        for (Key key : (Collection<Key>) objectKeys) {
            keys[currLoc] = key.getId();
            currLoc++;
        }
        LinkedHashSet<RegistryObject> col = new LinkedHashSet<RegistryObject>();
        LifeCycleManager lcm = registryService.getLifeCycleManagerImpl();

        if (LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType))
        {
            try
            {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.