Search in sources :

Example 1 with GuiceApplication

use of com.peterphi.std.guice.apploader.GuiceApplication in project stdlib by petergeneric.

the class GuiceRegistry method stop.

/**
 * Shutdown all services
 */
public synchronized void stop() {
    if (injector != null) {
        // Shutdown the services first
        for (GuiceApplication service : services) {
            try {
                service.stopping();
            } catch (Throwable t) {
                log.warn("Error shutting down service " + service + ": " + t.getMessage(), t);
            }
        }
        // Now shutdown the environment
        ShutdownManager manager = injector.getInstance(ShutdownManager.class);
        manager.shutdown();
        // Allow the environment to be garbage collected
        injector = null;
    }
}
Also used : GuiceApplication(com.peterphi.std.guice.apploader.GuiceApplication) ShutdownManager(com.peterphi.std.guice.common.shutdown.iface.ShutdownManager)

Aggregations

GuiceApplication (com.peterphi.std.guice.apploader.GuiceApplication)1 ShutdownManager (com.peterphi.std.guice.common.shutdown.iface.ShutdownManager)1