Examples of LifecycleManager


Examples of com.google.gerrit.lifecycle.LifecycleManager

    return snapshot.lastModified() != jar.lastModified();
  }

  public void start(PluginGuiceEnvironment env) throws Exception {
    Injector root = newRootInjector(env);
    manager = new LifecycleManager();

    AutoRegisterModules auto = null;
    if (sysModule == null && sshModule == null && httpModule == null) {
      auto = new AutoRegisterModules(name, env, jarFile, classLoader);
      auto.discover();
View Full Code Here

Examples of com.google.gerrit.lifecycle.LifecycleManager

      //
      sysInjector.getInstance(HttpCanonicalWebUrlProvider.class)
          .setHttpServletRequest(
              webInjector.getProvider(HttpServletRequest.class));

      manager = new LifecycleManager();
      manager.add(dbInjector);
      manager.add(cfgInjector);
      manager.add(sysInjector);
      manager.add(sshInjector);
      manager.add(webInjector);
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

    {
        // Always get the Guice injector from Governator
        Injector injector = LifecycleInjector.builder().createInjector();
        injector.getInstance(ExampleObjectA.class);

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

        // Always start the Lifecycle Manager
        manager.start();

        // by calling start() warm up begins. The console will show
        // something like this (the order may be slightly different):
        /*
            b.isWarm() false
            c.isWarm() false
            ExampleObjectB warm up start
            ExampleObjectC warm up start
            ExampleObjectB warm up end
            ExampleObjectC warm up end
            b.isWarm() true
            c.isWarm() true
            ExampleObjectA warm up start
            ExampleObjectA warm up end
         */

        // your app would execute here

        // Always close the Lifecycle Manager at app end
        manager.close();
    }
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

                        }
                    }
                )
            .createInjector();

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

        // Always start the Lifecycle Manager
        manager.start();

        System.out.println(injector.getInstance(ExampleObjectA.class).getValue());
        System.out.println(injector.getInstance(ExampleObjectB.class).getValue());
        System.out.println(injector.getInstance(ExampleObjectC.class).getValue());

        /*
            Console will output:
                ExampleObjectA should see this
                b
                c
         */

        // your app would execute here

        // Always close the Lifecycle Manager at app end
        manager.close();
    }
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

        Injector injector = LifecycleInjector.builder().createInjector();

        // This causes ExampleService and its dependency, ExampleResource, to get instantiated
        injector.getInstance(ExampleService.class);

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

        // Always start the Lifecycle Manager
        manager.start();

        // your app would execute here

        // Always close the Lifecycle Manager at app end
        manager.close();

        /*
            The console output should show:
                ExampleResource construction
                ExampleResource setup
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

                        }
                    }
                )
            .createInjector();

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

        // Always start the Lifecycle Manager
        manager.start();

        // your app would execute here

        // Always close the Lifecycle Manager at app end
        manager.close();
    }
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

            )
            .createInjector();

        ExampleObject       obj = injector.getInstance(ExampleObject.class);

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

        // Always start the Lifecycle Manager
        manager.start();

        System.out.println(obj.getAString());
        System.out.println(obj.getAnInt());
        System.out.println(obj.getADouble());

        // your app would execute here

        // Always close the Lifecycle Manager at app end
        manager.close();
    }
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

                    }
                }
            )
            .createInjector();

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

        // Always start the Lifecycle Manager
        manager.start();

        System.out.println(injector.getInstance(ExampleObjectA.class).getValue());
        System.out.println(injector.getInstance(ExampleObjectB.class).getValue());
        System.out.println(injector.getInstance(ExampleObjectC.class).getValue());

        /*
            Console will output:
                letter A - 1
                letter B - 2
                letter C - 3
         */

        // your app would execute here

        // Always close the Lifecycle Manager at app end
        manager.close();
    }
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

            .usingBasePackages("autobind"// specify a package for CLASSPATH scanning so that Governator finds the AutoBindSingleton
            .createInjector();

        // NOTE: ExampleService will be created at this point - you should see "ExampleService auto-bind construction" in the console

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

        // Always start the Lifecycle Manager
        manager.start();

        // your app would execute here

        // Always close the Lifecycle Manager at app end
        manager.close();
    }
View Full Code Here

Examples of com.netflix.governator.lifecycle.LifecycleManager

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

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

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

        manager.close();

        Assert.assertEquals(instance.startCount.get(), 1);
        Assert.assertEquals(instance.finishCount.get(), 1);
    }
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.