@Override public void stop(StopContext context) { if (container != null) { container.stop(); } }
public void stopCache() { if (!managedCache) { if (logger.isInfoEnabled()) { logger.info("Mobicents Cache stopping..."); } this.jBossCacheContainer.stop(); //this.jBossCacheManager.destroy(); } if (logger.isInfoEnabled()) { logger.info("Mobicents Cache stopped."); } }
public void stop() { Iterator<Entry<String, MobicentsCluster>> iterator=clustersMap.entrySet().iterator(); while(iterator.hasNext()) { Entry<String, MobicentsCluster> curr=iterator.next(); MobicentsCluster cluster=clustersMap.remove(curr.getKey()); if(cluster!=null) cluster.stopCluster(); } if(this.jBossCacheContainer!=null) { this.jBossCacheContainer.stop(); this.jBossCacheContainer=null; } if(this.cacheExecutorService!=null) { this.cacheExecutorService.terminate(); this.cacheExecutorService = null; } }
public void stop() { cache.clear(); cacheContainer.stop(); }
@AfterMethod public void tearDown() throws Exception { TestingUtil.replaceComponent(cache, CacheNotifier.class, origNotifier, true); TestingUtil.killCaches(cache); cm.stop(); }
public void testKeySetAfterExpiryInTransaction(Method m) throws Exception { CacheContainer cc = createTransactionalCacheContainer(); try { doKeySetAfterExpiryInTransaction(m, cc); } finally { cc.stop(); } }
public void testValuesAfterExpiryInTransaction(Method m) throws Exception { CacheContainer cc = createTransactionalCacheContainer(); try { doValuesAfterExpiryInTransaction(m, cc); } finally { cc.stop(); } }
public void testEntrySetAfterExpiryInTransaction(Method m) throws Exception { CacheContainer cc = createTransactionalCacheContainer(); try { doEntrySetAfterExpiryInTransaction(m, cc); } finally { cc.stop(); } }
public void testJmxRegistrationAtStartupAndStop(Method m) throws Exception { final String otherJmxDomain = getMethodSpecificJmxDomain(m, JMX_DOMAIN); CacheContainer otherContainer = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(otherJmxDomain, true, false, true); ObjectName otherName = getCacheManagerObjectName(otherJmxDomain); try { assertEquals("0", server.getAttribute(otherName, "CreatedCacheCount")); } finally { otherContainer.stop(); } Exceptions.expectException(InstanceNotFoundException.class, () -> server.getAttribute(otherName, "CreatedCacheCount")); }
public void testCustomCacheManagerName(Method m) throws Exception { final String otherJmxDomain = getMethodSpecificJmxDomain(m, JMX_DOMAIN); CacheContainer otherContainer = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(otherJmxDomain, "Hibernate2LC", true, false, true); ObjectName otherName = getCacheManagerObjectName(otherJmxDomain, "Hibernate2LC"); try { assertEquals("0", server.getAttribute(otherName, "CreatedCacheCount")); } finally { otherContainer.stop(); } }
@Test public void profileInfinispanLocalDirectory() throws InterruptedException, IOException { CacheContainer cacheManager = CacheTestSupport.createLocalCacheManager(); try { Cache cache = cacheManager.getCache(); Directory dir = DirectoryBuilder.newDirectoryInstance(cache, cache, cache, "iname").create(); testDirectory(dir, "InfinispanLocal"); } finally { cacheManager.stop(); } }
public void testEntrySetAfterExpiryWithStore(Method m) throws Exception { String location = TestingUtil.tmpDirectory(ExpiryTest.class); CacheContainer cc = createCacheContainerWithStore(location); try { doTestEntrySetAfterExpiryInPut(m, cc); } finally { cc.stop(); Util.recursiveFileRemove(location); } }
public void testInfinispanDirectory() throws Exception { final int OPERATIONS = 100; CacheContainer cacheContainer = CacheTestSupport.createTestCacheManager(); Cache cache = cacheContainer.getCache(); Directory directory = DirectoryBuilder.newDirectoryInstance(cache, cache, cache, "indexName").create(); CacheTestSupport.initializeDirectory(directory); File document = CacheTestSupport.createDummyDocToIndex("document.lucene", 10000); for (int i = 0; i < OPERATIONS; i++) { CacheTestSupport.doWriteOperation(directory, document); CacheTestSupport.doReadOperation(directory); } IndexReader ir = DirectoryReader.open(directory); IndexSearcher search = new IndexSearcher(ir); Term t = new Term("info", "good"); Query query = new TermQuery(t); TopDocs hits = search.search(query, 1); ir.close(); assert OPERATIONS == hits.totalHits; directory.close(); cacheContainer.stop(); }
@Test public void profileInfinispanLocalDirectory() throws InterruptedException, IOException { CacheContainer cacheContainer = CacheTestSupport.createLocalCacheManager(); try { Cache cache = cacheContainer.getCache(); Directory dir = DirectoryBuilder.newDirectoryInstance(cache, cache, cache, indexName).chunkSize(CHUNK_SIZE).create(); stressTestDirectoryInternal(dir, dir, "InfinispanLocal"); verifyDirectoryState(); } finally { cacheContainer.stop(); } }
public void testMultipleManagersOnSameServerFails(Method method) throws Exception { final String jmxDomain = JMX_DOMAIN + '.' + method.getName(); cm = TestCacheManagerFactory.createClusteredCacheManagerEnforceJmxDomain(jmxDomain); ConfigurationBuilder localCache = config();//local by default localCache.jmxStatistics().enable(); cm.defineConfiguration("local_cache", localCache.build()); cm.getCache("local_cache"); assert existsObject(getCacheObjectName(jmxDomain, "local_cache(local)", "Statistics")); expectException(EmbeddedCacheManagerStartupException.class, JmxDomainConflictException.class, () -> TestCacheManagerFactory.createClusteredCacheManagerEnforceJmxDomain(jmxDomain, false)); server = PerThreadMBeanServerLookup.getThreadMBeanServer(); CacheContainer duplicateAllowedContainer =TestCacheManagerFactory.createClusteredCacheManagerEnforceJmxDomain(jmxDomain, true); try { final String duplicateName = jmxDomain + "2"; ObjectName duplicateObjectName = getCacheManagerObjectName(duplicateName); server.getAttribute(duplicateObjectName, "CreatedCacheCount").equals("0"); } finally { duplicateAllowedContainer.stop(); } }
public void testCorrectShutdown() { CacheContainer cc = null; try { ConfigurationBuilder cfg = new ConfigurationBuilder(); cfg .transaction() .transactionMode(TransactionMode.TRANSACTIONAL) .indexing() .index(Index.ALL) .addIndexedEntity(Person.class) .addProperty("default.directory_provider", "local-heap") .addProperty("lucene_version", "LUCENE_CURRENT"); cc = TestCacheManagerFactory.createCacheManager(cfg); Cache<?, ?> cache = cc.getCache(); SearchIntegrator sfi = TestingUtil.extractComponent(cache, SearchIntegrator.class); assert ! sfi.isStopped(); cc.stop(); assert sfi.isStopped(); } finally { // proper cleanup for exceptional execution TestingUtil.killCacheManagers(cc); } }