List of usage examples for com.google.common.util.concurrent AbstractIdleService isRunning
@Override public final boolean isRunning()
From source file:org.grycap.gpf4med.manager.ShutdownHook.java
/** * Creates an instance of this class and registers it with the JVM. *///from w ww. j a v a 2 s. co 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. *//*from w w w. j a v a 2s .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(); } } } }; getRuntime().addShutdownHook(hook); }