/** * @see org.apache.commons.jcs.auxiliary.AbstractAuxiliaryCacheFactory#initialize() */ @Override public void initialize() { super.initialize(); managers = new ConcurrentHashMap<RemoteLocation, RemoteCacheManager>(); managerLock = new ReentrantLock(); monitor = new RemoteCacheMonitor(); monitor.setDaemon(true); }
/** * Notifies the cache monitor that an error occurred, and kicks off the error recovery process. */ public void notifyError() { log.debug( "Notified of an error." ); bad(); synchronized ( this ) { notify(); } }
/** * @see org.apache.commons.jcs.auxiliary.AbstractAuxiliaryCacheFactory#dispose() */ @Override public void dispose() { for (RemoteCacheManager manager : managers.values()) { manager.release(); } managers.clear(); if (monitor != null) { monitor.notifyShutdown(); try { monitor.join(5000); } catch (InterruptedException e) { // swallow } monitor = null; } super.dispose(); } }
/** * Returns the singleton instance. * <p> * @return The instance value */ static RemoteCacheMonitor getInstance() { synchronized ( RemoteCacheMonitor.class ) { if ( instance == null ) { return instance = new RemoteCacheMonitor(); } } return instance; }
RemoteCacheMonitor.getInstance().notifyError();
monitor.addManager(ins);
monitor = RemoteCacheMonitor.getInstance();
/** * @see junit.framework.TestCase#setUp() */ @Override protected void setUp() throws Exception { super.setUp(); cattr = new RemoteCacheAttributes(); service = new MockRemoteCacheService<String, String>(); listener = new MockRemoteCacheListener<String, String>(); monitor = new RemoteCacheMonitor(); }
RemoteCacheMonitor.getInstance().notifyError();