/** * create the singelton EventService object if it doesn't exist already. Check if directory server * supports the Persistent Search Control and the Proxy Auth Control * * @supported.api */ public static synchronized EventService getEventService() throws EventException, LDAPException { if (_shutdownCalled) { return null; } // Make sure only one instance of this class is created. if (_instance == null) { // Determine the Idle time out value for Event Service (LB/Firewall) // scenarios. Value == 0 imples no idle timeout. _idleTimeOut = getPropertyIntValue(EVENT_IDLE_TIMEOUT_INTERVAL, _idleTimeOut); _idleTimeOutMills = _idleTimeOut * 60000; ShutdownManager shutdownMan = ShutdownManager.getInstance(); if (shutdownMan.acquireValidLock()) { try { if (_idleTimeOut == 0) { _instance = new EventService(); } else { _instance = new EventServicePolling(); } shutdownMan.addShutdownListener( new ShutdownListener() { public void shutdown() { if (_instance != null) { _instance.finalize(); } } }); } finally { shutdownMan.releaseLockAndNotify(); } } } return _instance; }
public void destroy() { ShutdownManager shutdownMan = ShutdownManager.getInstance(); if (shutdownMan.acquireValidLock()) { try { shutdownMan.shutdown(); } finally { shutdownMan.releaseLockAndNotify(); } } }