/** * Gracefully terminate the active use of the public methods of this component. This method should * be the last one called on a given instance of this component. * * @exception LifecycleException if this component detects a fatal error that needs to be reported */ public void stop() throws LifecycleException { if (debug >= 1) log("Stopping"); // Validate and update our current component state if (!started) throw new LifecycleException(sm.getString("standardManager.notStarted")); lifecycle.fireLifecycleEvent(STOP_EVENT, null); started = false; // Stop the background reaper thread threadStop(); // Write out sessions try { unload(); } catch (IOException e) { log(sm.getString("standardManager.managerUnload"), e); } // Expire all active sessions Session sessions[] = findSessions(); for (int i = 0; i < sessions.length; i++) { StandardSession session = (StandardSession) sessions[i]; if (!session.isValid()) continue; try { session.expire(); } catch (Throwable t) {; } } // Require a new random number generator if we are restarted this.random = null; }
/** Override persistence since they don't go hand in hand with replication for now. */ public void unload() throws IOException { if (!getDistributable()) { super.unload(); } }