title: Module Initialization And Destruction handlers in Guice?
body: <p>The following link describes how to handle module initialization and destruction in Guice using a Service interface with a start() and stop() method:</p>
  
  <p><a href="http://code.google.com/p/google-guice/wiki/ModulesShouldBeFastAndSideEffectFree" rel="nofollow">http://code.google.com/p/google-guice/wiki/ModulesShouldBeFastAndSideEffectFree</a></p>
  
  <p>The documentation explains that the creation of the service looks like this in client code:</p>
  
  <pre><code>public static void main(String[] args) throws Exception {
      Injector injector = Guice.createInjector(
          new DatabaseModule(),
          new WebserverModule(),
          ...
      );
  
      Service databaseConnectionPool = injector.getInstance(
          Key.get(Service.class, DatabaseService.class));
      databaseConnectionPool.start();
      addShutdownHook(databaseConnectionPool);
  
      Service webserver = injector.getInstance(
          Key.get(Service.class, WebserverService.class));
      webserver.start();
      addShutdownHook(webserver);
  }
  </code></pre>
  
  <p>But does not list any sample implementation of a Concrete Service class. Can anyone provide me with one? At least a sample implementation of what would start() and stop() contain.</p>