@Test public void testProgrammaticConfigurationWorksProperlyWhenNoDefaultCacheConfigured() { Configuration mgrConfig = new Configuration(); mgrConfig.setUpdateCheck(false); new CacheManager(mgrConfig).shutdown(); }
public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } } localTransactionsRecoveryThread = null; if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } if (registeredMgmtSvrBind != null) { ManagementServerLoader.unregister(registeredMgmtSvrBind, this); registeredMgmtSvrBind = null; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManagerPeerProvider.dispose(); } } if (cacheManagerTimer != null) { cacheManagerTimer.cancel(); cacheManagerTimer.purge(); } cacheManagerEventListenerRegistry.dispose(); ALL_CACHE_MANAGERS.remove(this); for (Ehcache cache : ehcaches.values()) { if (cache != null) { cache.dispose(); } } if (defaultCache != null) { defaultCache.dispose(); } status = Status.STATUS_SHUTDOWN; XARequestProcessor.shutdown(); if (this == singleton) { singleton = null; } terracottaClient.shutdown(); transactionController = null; removeShutdownHook(); if (featuresManager != null) { featuresManager.dispose(); } if (diskStorePathManager != null) { diskStorePathManager.releaseLock(); } try { ConcurrencyUtil.shutdownAndWaitForTermination(statisticsExecutor, POOL_SHUTDOWN_TIMEOUT_SECS); } catch (TimeoutException e) { LOG.warn(e.getMessage(), e); } getConfiguration().cleanup(); final String name = CACHE_MANAGERS_REVERSE_MAP.remove(this); CACHE_MANAGERS_MAP.remove(name); } }
CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } } localTransactionsRecoveryThread = null; if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } if (registeredMgmtSvrBind != null) { ManagementServerLoader.unregister(registeredMgmtSvrBind, this); registeredMgmtSvrBind = null; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManagerPeerProvider.dispose(); } } if (cacheManagerTimer != null) { cacheManagerTimer.cancel(); cacheManagerTimer.purge(); } cacheManagerEventListenerRegistry.dispose(); ALL_CACHE_MANAGERS.remove(this); for (Ehcache cache : ehcaches.values()) { if (cache != null) { cache.dispose(); } } if (defaultCache != null) { defaultCache.dispose(); } status = Status.STATUS_SHUTDOWN; XARequestProcessor.shutdown(); if (this == singleton) { singleton = null; } terracottaClient.shutdown(); transactionController = null; removeShutdownHook(); if (featuresManager != null) { featuresManager.dispose(); } if (diskStorePathManager != null) { diskStorePathManager.releaseLock(); } try { ConcurrencyUtil.shutdownAndWaitForTermination(statisticsExecutor, POOL_SHUTDOWN_TIMEOUT_SECS); } catch (TimeoutException e) { LOG.warn(e.getMessage(), e); } getConfiguration().cleanup(); final String name = CACHE_MANAGERS_REVERSE_MAP.remove(this); CACHE_MANAGERS_MAP.remove(name); } } }
CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } } localTransactionsRecoveryThread = null; if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } if (registeredMgmtSvrBind != null) { ManagementServerLoader.unregister(registeredMgmtSvrBind, this); registeredMgmtSvrBind = null; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManagerPeerProvider.dispose(); } } if (cacheManagerTimer != null) { cacheManagerTimer.cancel(); cacheManagerTimer.purge(); } cacheManagerEventListenerRegistry.dispose(); ALL_CACHE_MANAGERS.remove(this); for (Ehcache cache : ehcaches.values()) { if (cache != null) { cache.dispose(); } } if (defaultCache != null) { defaultCache.dispose(); } status = Status.STATUS_SHUTDOWN; XARequestProcessor.shutdown(); if (this == singleton) { singleton = null; } terracottaClient.shutdown(); transactionController = null; removeShutdownHook(); if (featuresManager != null) { featuresManager.dispose(); } if (diskStorePathManager != null) { diskStorePathManager.releaseLock(); } try { ConcurrencyUtil.shutdownAndWaitForTermination(statisticsExecutor, POOL_SHUTDOWN_TIMEOUT_SECS); } catch (TimeoutException e) { LOG.warn(e.getMessage(), e); } getConfiguration().cleanup(); final String name = CACHE_MANAGERS_REVERSE_MAP.remove(this); CACHE_MANAGERS_MAP.remove(name); } } CacheManager(Configuration configuration);  CacheManager(String configurationFileName);  CacheManager(URL configurationURL);  CacheManager(InputStream configurationInputStream);  CacheManager(); }
CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } } localTransactionsRecoveryThread = null; if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } if (registeredMgmtSvrBind != null) { ManagementServerLoader.unregister(registeredMgmtSvrBind, this); registeredMgmtSvrBind = null; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManagerPeerProvider.dispose(); } } if (cacheManagerTimer != null) { cacheManagerTimer.cancel(); cacheManagerTimer.purge(); } cacheManagerEventListenerRegistry.dispose(); ALL_CACHE_MANAGERS.remove(this); for (Ehcache cache : ehcaches.values()) { if (cache != null) { cache.dispose(); } } if (defaultCache != null) { defaultCache.dispose(); } status = Status.STATUS_SHUTDOWN; XARequestProcessor.shutdown(); if (this == singleton) { singleton = null; } terracottaClient.shutdown(); transactionController = null; removeShutdownHook(); if (featuresManager != null) { featuresManager.dispose(); } if (diskStorePathManager != null) { diskStorePathManager.releaseLock(); } try { ConcurrencyUtil.shutdownAndWaitForTermination(statisticsExecutor, POOL_SHUTDOWN_TIMEOUT_SECS); } catch (TimeoutException e) { LOG.warn(e.getMessage(), e); } getConfiguration().cleanup(); final String name = CACHE_MANAGERS_REVERSE_MAP.remove(this); CACHE_MANAGERS_MAP.remove(name); } } CacheManager(Configuration configuration);  CacheManager(String configurationFileName);  CacheManager(URL configurationURL);  CacheManager(InputStream configurationInputStream);  CacheManager(); Pool getOnHeapPool(); Pool getOnDiskPool(); String getClusterUUID(); Store createTerracottaStore(Ehcache cache); WriteBehind createTerracottaWriteBehind(Ehcache cache); CacheEventListener createTerracottaEventReplicator(Ehcache cache); static CacheManager create(); static CacheManager newInstance(); static CacheManager getInstance(); static CacheManager create(String configurationFileName); static CacheManager newInstance(String configurationFileName); static CacheManager create(URL configurationFileURL); static CacheManager newInstance(URL configurationFileURL); static CacheManager create(InputStream inputStream); static CacheManager newInstance(InputStream inputStream); static CacheManager create(Configuration config); static CacheManager newInstance(Configuration config); static CacheManager getCacheManager(String name); Cache getCache(String name); Ehcache getEhcache(String name); synchronized void addCache(String cacheName); void addCache(Cache cache); synchronized void addCache(Ehcache cache); synchronized void addDecoratedCache(Ehcache decoratedCache); synchronized void addDecoratedCacheIfAbsent(Ehcache decoratedCache); boolean cacheExists(String cacheName); void removeAllCaches(); @Deprecated void removalAll(); synchronized void removeCache(String cacheName); void shutdown(); String[] getCacheNames(); Status getStatus(); void clearAll(); void clearAllStartingWith(String prefix); CacheManagerPeerProvider getCacheManagerPeerProvider(String scheme); Map<String, CacheManagerPeerProvider> getCacheManagerPeerProviders(); CacheManagerPeerListener getCachePeerListener(String scheme); CacheManagerEventListener getCacheManagerEventListener(); void setCacheManagerEventListener(CacheManagerEventListener cacheManagerEventListener); CacheManagerEventListenerRegistry getCacheManagerEventListenerRegistry(); synchronized void replaceCacheWithDecoratedCache(Ehcache ehcache, Ehcache decoratedCache); String getName(); boolean isNamed(); void setName(String name); @Override String toString(); DiskStorePathManager getDiskStorePathManager(); FailSafeTimer getTimer(); CacheCluster getCluster(ClusterScheme scheme); String getOriginalConfigurationText(); String getActiveConfigurationText(); String getOriginalConfigurationText(String cacheName); String getActiveConfigurationText(String cacheName); Configuration getConfiguration(); synchronized Ehcache addCacheIfAbsent(final Ehcache cache); synchronized Ehcache addCacheIfAbsent(final String cacheName); TransactionController getTransactionController(); TransactionIDFactory getOrCreateTransactionIDFactory(); FeaturesManager getFeaturesManager(); }
CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } } localTransactionsRecoveryThread = null; if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } if (registeredMgmtSvrBind != null) { ManagementServerLoader.unregister(registeredMgmtSvrBind, this); registeredMgmtSvrBind = null; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManagerPeerProvider.dispose(); } } if (cacheManagerTimer != null) { cacheManagerTimer.cancel(); cacheManagerTimer.purge(); } cacheManagerEventListenerRegistry.dispose(); ALL_CACHE_MANAGERS.remove(this); for (Ehcache cache : ehcaches.values()) { if (cache != null) { cache.dispose(); } } if (defaultCache != null) { defaultCache.dispose(); } status = Status.STATUS_SHUTDOWN; XARequestProcessor.shutdown(); if (this == singleton) { singleton = null; } terracottaClient.shutdown(); transactionController = null; removeShutdownHook(); if (featuresManager != null) { featuresManager.dispose(); } if (diskStorePathManager != null) { diskStorePathManager.releaseLock(); } try { ConcurrencyUtil.shutdownAndWaitForTermination(statisticsExecutor, POOL_SHUTDOWN_TIMEOUT_SECS); } catch (TimeoutException e) { LOG.warn(e.getMessage(), e); } getConfiguration().cleanup(); final String name = CACHE_MANAGERS_REVERSE_MAP.remove(this); CACHE_MANAGERS_MAP.remove(name); } } CacheManager(Configuration configuration);  CacheManager(String configurationFileName);  CacheManager(URL configurationURL);  CacheManager(InputStream configurationInputStream);  CacheManager(); Pool getOnHeapPool(); Pool getOnDiskPool(); String getClusterUUID(); Store createTerracottaStore(Ehcache cache); WriteBehind createTerracottaWriteBehind(Ehcache cache); CacheEventListener createTerracottaEventReplicator(Ehcache cache); static CacheManager create(); static CacheManager newInstance(); static CacheManager getInstance(); static CacheManager create(String configurationFileName); static CacheManager newInstance(String configurationFileName); static CacheManager create(URL configurationFileURL); static CacheManager newInstance(URL configurationFileURL); static CacheManager create(InputStream inputStream); static CacheManager newInstance(InputStream inputStream); static CacheManager create(Configuration config); static CacheManager newInstance(Configuration config); static CacheManager getCacheManager(String name); Cache getCache(String name); Ehcache getEhcache(String name); synchronized void addCache(String cacheName); void addCache(Cache cache); synchronized void addCache(Ehcache cache); synchronized void addDecoratedCache(Ehcache decoratedCache); synchronized void addDecoratedCacheIfAbsent(Ehcache decoratedCache); boolean cacheExists(String cacheName); void removeAllCaches(); @Deprecated void removalAll(); synchronized void removeCache(String cacheName); void shutdown(); String[] getCacheNames(); Status getStatus(); void clearAll(); void clearAllStartingWith(String prefix); CacheManagerPeerProvider getCacheManagerPeerProvider(String scheme); Map<String, CacheManagerPeerProvider> getCacheManagerPeerProviders(); CacheManagerPeerListener getCachePeerListener(String scheme); CacheManagerEventListener getCacheManagerEventListener(); void setCacheManagerEventListener(CacheManagerEventListener cacheManagerEventListener); CacheManagerEventListenerRegistry getCacheManagerEventListenerRegistry(); synchronized void replaceCacheWithDecoratedCache(Ehcache ehcache, Ehcache decoratedCache); String getName(); boolean isNamed(); void setName(String name); @Override String toString(); DiskStorePathManager getDiskStorePathManager(); FailSafeTimer getTimer(); CacheCluster getCluster(ClusterScheme scheme); String getOriginalConfigurationText(); String getActiveConfigurationText(); String getOriginalConfigurationText(String cacheName); String getActiveConfigurationText(String cacheName); Configuration getConfiguration(); synchronized Ehcache addCacheIfAbsent(final Ehcache cache); synchronized Ehcache addCacheIfAbsent(final String cacheName); TransactionController getTransactionController(); TransactionIDFactory getOrCreateTransactionIDFactory(); FeaturesManager getFeaturesManager(); static final String DEFAULT_NAME; static final double ON_HEAP_THRESHOLD; static final List<CacheManager> ALL_CACHE_MANAGERS; static final String ENABLE_SHUTDOWN_HOOK_PROPERTY; }