use of org.forgerock.util.thread.listener.ShutdownPriority in project OpenAM by OpenRock.
the class ShutdownManager method shutdown.
/**
* Shuts down all the listeners in this ShutdownManager.
*/
public void shutdown() throws IllegalMonitorStateException {
if (acquireValidLock()) {
try {
shutdownCalled = true;
List<ShutdownPriority> priorities = ShutdownPriority.getPriorities();
for (ShutdownPriority i : priorities) {
for (Iterator<ShutdownListener> j = listeners[i.getIntValue() - 1].iterator(); j.hasNext(); ) {
j.next().shutdown();
// remove the components which have been shutdown to avoid
// problem when the shutdown function is called twice.
j.remove();
}
}
if (appSSOTokenDestroyer != null) {
appSSOTokenDestroyer.shutdown();
appSSOTokenDestroyer = null;
}
instance = null;
} catch (RuntimeException t) {
Debug.getInstance("amUtil").error("Error during shutdown", t);
throw t;
} finally {
releaseLockAndNotify();
}
} else {
throw new IllegalMonitorStateException("Failed to acquire lock during shutdown.");
}
}
Aggregations