/** * Gets the CacheHub instance. For backward compatibility, if this creates the instance it will * attempt to configure it with the default configuration. If you want to configure from your * own source, use {@link #getUnconfiguredInstance}and then call {@link #configure} * <p> * @return CompositeCacheManager * @throws CacheException if the configuration cannot be loaded */ public static synchronized CompositeCacheManager getInstance() throws CacheException { return getInstance( CacheConstants.DEFAULT_CONFIG ); }
/** * Gets the CacheHub instance. For backward compatibility, if this creates the instance it will * attempt to configure it with the default configuration. If you want to configure from your * own source, use {@link #getUnconfiguredInstance}and then call {@link #configure} * <p> * @return CompositeCacheManager * @throws CacheException if the configuration cannot be loaded */ public static synchronized CompositeCacheManager getInstance() throws CacheException { return getInstance( CacheConstants.DEFAULT_CONFIG ); }
private JcsCacheManager() { this(CompositeCacheManager.getInstance()); }
/** * Default constructor */ public JCSAdminBean() { super(); try { this.cacheHub = CompositeCacheManager.getInstance(); } catch (CacheException e) { throw new RuntimeException("Could not retrieve cache manager instance", e); } }
/** * Default constructor */ public JCSAdminBean() { super(); try { this.cacheHub = CompositeCacheManager.getInstance(); } catch (CacheException e) { throw new RuntimeException("Could not retrieve cache manager instance", e); } }
/** * Make sure we have a cache manager. This should have happened in the init method. * * @throws CacheException if the configuration cannot be loaded */ protected synchronized void ensureCacheManager() throws CacheException { if ( cacheMgr == null || !cacheMgr.isInitialized() ) { cacheMgr = CompositeCacheManager.getInstance(); } }
/** * shuts the cache down. */ @Override public void destroy() { super.destroy(); log.info( "Shutting down remote cache " ); try { CompositeCacheManager.getInstance().shutDown(); } catch (CacheException e) { log.error("Could not retrieve cache manager instance", e); } } }
/** * This gets the singleton instance of the CompositeCacheManager and calls shutdown. * <p> * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent) */ @Override public void contextDestroyed( ServletContextEvent arg0 ) { if ( log.isInfoEnabled() ) { log.info( "contextDestroyed, shutting down JCS." ); } try { CompositeCacheManager.getInstance().shutDown(); } catch (CacheException e) { log.error( "Could not retrieve cache manager instance", e ); } } }
/** * Initializes the cache. * <p> * This provides an easy extension point. Simply extend this servlet and override the init * method to change the way the properties are loaded. * @param config * @throws ServletException */ @Override public void init( ServletConfig config ) throws ServletException { try { cacheMgr = CompositeCacheManager.getInstance(); } catch (CacheException e) { throw new ServletException(e); } remoteCacheService = createRemoteHttpCacheService( cacheMgr ); super.init( config ); }
public void stop() { if (enable) { LOGGER.logMessage(LogLevel.INFO, "Shutting down remote cache "); CompositeCacheManager.getInstance().shutDown(); LOGGER.logMessage(LogLevel.INFO, "jcscacheplugin is stopped"); } }
/** * @see junit.framework.TestCase#tearDown() */ @Override protected void tearDown() throws Exception { CompositeCacheManager.getInstance().shutDown(); }
@Override protected void setUp() throws Exception { super.setUp(); //First shut down any previously running manager. manager = CompositeCacheManager.getInstance(); manager.shutDown(); }
/** * Test tearDown. Dispose of the cache. */ @Override public void tearDown() { try { CompositeCacheManager cacheMgr = CompositeCacheManager.getInstance(); cacheMgr.shutDown(); } catch ( Exception e ) { // log.error(e); } }
/** * Test tearDown. Dispose of the cache. */ @Override public void tearDown() { try { CompositeCacheManager cacheMgr = CompositeCacheManager.getInstance(); cacheMgr.shutDown(); } catch ( Exception e ) { e.printStackTrace(); } } }
/** * Test tearDown. Dispose of the cache. */ @Override public void tearDown() { try { CompositeCacheManager cacheMgr = CompositeCacheManager.getInstance(); cacheMgr.shutDown(); } catch ( Exception e ) { // log.error(e); } }
/** * Test tearDown. Dispose of the cache. */ @Override public void tearDown() { try { CompositeCacheManager cacheMgr = CompositeCacheManager.getInstance(); cacheMgr.shutDown(); } catch ( Exception e ) { e.printStackTrace(); } } }
/** * Verify that the system properties are used. * @throws Exception * */ public void testSystemPropertyUsage() throws Exception { System.setProperty( JCS_DEFAULT_CACHEATTRIBUTES_MAX_OBJECTS, String.valueOf(testValue) ); JCS.setConfigFilename( "/TestSystemPropertyUsage.ccf" ); CacheAccess<String, String> jcs = JCS.getInstance( "someCacheNotInFile" ); manager = CompositeCacheManager.getInstance(); assertEquals( "System property value is not reflected.", testValue, jcs.getCacheAttributes().getMaxObjects()); }
/** * Verify that the system properties are used. * @throws Exception * */ public void testSystemPropertyUsage() throws Exception { System.setProperty( JCS_DEFAULT_CACHEATTRIBUTES_MAX_OBJECTS, String.valueOf(testValue) ); JCS.setConfigFilename( "/TestSystemPropertyUsage.ccf" ); CacheAccess<String, String> jcs = JCS.getInstance( "someCacheNotInFile" ); manager = CompositeCacheManager.getInstance(); assertEquals( "System property value is not reflected", testValue, jcs.getCacheAttributes().getMaxObjects()); }
/** Create the listener for testing */ @Override protected void setUp() throws Exception { factory = new LateralTCPCacheFactory(); factory.initialize(); cacheMgr = CompositeCacheManager.getInstance(); cacheEventLogger = new MockCacheEventLogger(); elementSerializer = new StandardSerializer(); listener = new LateralTCPDiscoveryListener( factory.getName(), cacheMgr ); }
/** Create the listener for testing */ @Override protected void setUp() throws Exception { factory = new LateralTCPCacheFactory(); factory.initialize(); cacheMgr = CompositeCacheManager.getInstance(); cacheEventLogger = new MockCacheEventLogger(); elementSerializer = new StandardSerializer(); listener = new LateralTCPDiscoveryListener( factory.getName(), cacheMgr ); }