List of usage examples for com.google.common.util.concurrent AbstractIdleService stopAsync
@Override public final Service stopAsync()
From source file:org.grycap.gpf4med.manager.ShutdownHook.java
/** * Creates an instance of this class and registers it with the JVM. *///from w w w .j av a2s.c o m public ShutdownHook() { hook = new Thread() { @Override public void run() { for (final Map.Entry<String, AbstractIdleService> entry : services.entrySet()) { final AbstractIdleService service = entry.getValue(); if (service != null && service.isRunning()) { service.stopAsync().awaitTerminated(); } } } }; Runtime.getRuntime().addShutdownHook(hook); }
From source file:eu.eubrazilcc.lvl.core.ShutdownHook.java
/** * Creates an instance of this class and registers it with the JVM. */// w ww .j av a2s . c om public ShutdownHook() { hook = new Thread() { @Override public void run() { for (final Map.Entry<String, AbstractIdleService> entry : services.entrySet()) { final AbstractIdleService service = entry.getValue(); if (service != null && service.isRunning()) { service.stopAsync().awaitTerminated(); } } } }; getRuntime().addShutdownHook(hook); }