Class Run

java.lang.Object
org.gwizard.services.Run

@Singleton
public class Run
extends java.lang.Object

A prettier interface to the Guava ServiceManager, with simple start() and stop() methods. Registers a Runtime shutdown hook to stop all services.

You can use the ServiceManager directly instead, but you'll have to register your own shutdown hook.

  • Constructor Summary

    Constructors
    Constructor Description
    Run​(javax.inject.Provider<com.google.common.util.concurrent.ServiceManager> serviceManager)  
  • Method Summary

    Modifier and Type Method Description
    void start()
    Start all services.
    void stop()
    Stop all services.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Run

      @Inject public Run​(javax.inject.Provider<com.google.common.util.concurrent.ServiceManager> serviceManager)
  • Method Details

    • start

      public void start()
      Start all services. This is shorthand for serviceManager.startAsync().awaitHealthy();
    • stop

      public void stop()
      Stop all services. This is shorthand for serviceManager.stopAsync().awaitStopped(); with the stopTimeoutSeconds wait interval.