Package com.netflix.governator.guice.runner.events

Examples of com.netflix.governator.guice.runner.events.SelfDestructingTerminationEvent


   
    @Test(enabled=false)
    public void shouldCreateSingletonAndExitAfter1Second() throws Exception {
        Stopwatch sw = new Stopwatch().start();
       
        final TerminationEvent event = new SelfDestructingTerminationEvent(1, TimeUnit.SECONDS);
        LifecycleInjector.builder()
            // Example of a singleton that will be created
            .withAdditionalModules(new AbstractModule() {
                @Override
                protected void configure() {
                    bind(SomeSingleton.class).asEagerSingleton();
                }
            })
            .withAdditionalBootstrapModules(
                StandaloneRunnerModule.builder()
                    .withTerminateEvent(event)
                    .build())
            .build()
            .createInjector();
       
        event.await();
        long elapsed = sw.elapsed(TimeUnit.MILLISECONDS);
        LOG.info("Elapsed: " + elapsed);
        Assert.assertTrue(initCalled.get());
        Assert.assertTrue(shutdownCalled.get());
        Assert.assertTrue(elapsed > 1000);
View Full Code Here


        LOG.info("Exit main");

    }
   
    public static void main(String args[]) {
        final TerminationEvent event = new SelfDestructingTerminationEvent(1, TimeUnit.SECONDS);
        LifecycleInjector.builder()
            // Example of a singleton that will be created
            .withAdditionalModules(new AbstractModule() {
                @Override
                protected void configure() {
View Full Code Here

TOP

Related Classes of com.netflix.governator.guice.runner.events.SelfDestructingTerminationEvent

Copyright © 2018 www.massapicom. 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.