当前位置: 首页>>代码示例>>Java>>正文


Java Cache.stop方法代码示例

本文整理汇总了Java中org.infinispan.Cache.stop方法的典型用法代码示例。如果您正苦于以下问题:Java Cache.stop方法的具体用法?Java Cache.stop怎么用?Java Cache.stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.infinispan.Cache的用法示例。


在下文中一共展示了Cache.stop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testConfigBuilder

import org.infinispan.Cache; //导入方法依赖的package包/类
public void testConfigBuilder() {
   GlobalConfiguration globalConfig = new GlobalConfigurationBuilder().globalJmxStatistics().transport().defaultTransport().build();

   Configuration cacheConfig = new ConfigurationBuilder().persistence().addStore(LevelDBStoreConfigurationBuilder.class).location(tmpDataDirectory)
         .expiredLocation(tmpExpiredDirectory).implementationType(LevelDBStoreConfiguration.ImplementationType.AUTO).build();

   StoreConfiguration cacheLoaderConfig = cacheConfig.persistence().stores().get(0);
   assertTrue(cacheLoaderConfig instanceof LevelDBStoreConfiguration);
   LevelDBStoreConfiguration leveldbConfig = (LevelDBStoreConfiguration) cacheLoaderConfig;
   assertEquals(tmpDataDirectory, leveldbConfig.location());
   assertEquals(tmpExpiredDirectory, leveldbConfig.expiredLocation());

   EmbeddedCacheManager cacheManager = new DefaultCacheManager(globalConfig);

   cacheManager.defineConfiguration("testCache", cacheConfig);

   cacheManager.start();
   Cache<String, String> cache = cacheManager.getCache("testCache");

   cache.put("hello", "there");
   cache.stop();
   cacheManager.stop();
}
 
开发者ID:danberindei,项目名称:infinispan-cachestore-leveldb,代码行数:24,代码来源:ConfigurationTest.java

示例2: testLegacyJavaConfig

import org.infinispan.Cache; //导入方法依赖的package包/类
@Test(enabled = false, description = "ISPN-3388")
public void testLegacyJavaConfig() {
   GlobalConfiguration globalConfig = new GlobalConfigurationBuilder().globalJmxStatistics().transport().defaultTransport().build();

   Configuration cacheConfig = new ConfigurationBuilder().persistence().addStore(LevelDBStoreConfigurationBuilder.class).addProperty("location", tmpDataDirectory)
         .addProperty("expiredLocation", tmpExpiredDirectory).addProperty("implementationType", LevelDBStoreConfiguration.ImplementationType.AUTO.toString()).build();

   EmbeddedCacheManager cacheManager = new DefaultCacheManager(globalConfig);

   cacheManager.defineConfiguration("testCache", cacheConfig);

   cacheManager.start();
   Cache<String, String> cache = cacheManager.getCache("testCache");

   cache.put("hello", "there legacy java");
   cache.stop();
   cacheManager.stop();
}
 
开发者ID:danberindei,项目名称:infinispan-cachestore-leveldb,代码行数:19,代码来源:ConfigurationTest.java

示例3: testConfigBuilder

import org.infinispan.Cache; //导入方法依赖的package包/类
public void testConfigBuilder() {
   GlobalConfiguration globalConfig = new GlobalConfigurationBuilder().globalJmxStatistics().transport().defaultTransport().build();

   Configuration cacheConfig = new ConfigurationBuilder().persistence().addStore(MapDBStoreConfigurationBuilder.class)
         .location(tmpDirectory)
         .compression(true)
         .build();

   StoreConfiguration cacheLoaderConfig = cacheConfig.persistence().stores().get(0);
   assertTrue(cacheLoaderConfig instanceof MapDBStoreConfiguration);
   MapDBStoreConfiguration config = (MapDBStoreConfiguration) cacheLoaderConfig;
   assertEquals(true, config.compression());
   
   EmbeddedCacheManager cacheManager = new DefaultCacheManager(globalConfig);

   cacheManager.defineConfiguration("testCache", cacheConfig);

   cacheManager.start();
   Cache<String, String> cache = cacheManager.getCache("testCache");

   cache.put("hello", "there");
   cache.stop();
   cacheManager.stop();
}
 
开发者ID:saturnism,项目名称:infinispan-cachestore-mapdb,代码行数:25,代码来源:ConfigurationTest.java

示例4: testConfigBuilder

import org.infinispan.Cache; //导入方法依赖的package包/类
public void testConfigBuilder() {
   GlobalConfiguration globalConfig = new GlobalConfigurationBuilder().globalJmxStatistics().transport().defaultTransport().build();

   Configuration cacheConfig = new ConfigurationBuilder().persistence().addStore(OffheapStoreConfigurationBuilder.class)
         .compression(true)
         .build();

   StoreConfiguration cacheLoaderConfig = cacheConfig.persistence().stores().get(0);
   assertTrue(cacheLoaderConfig instanceof OffheapStoreConfiguration);
   OffheapStoreConfiguration config = (OffheapStoreConfiguration) cacheLoaderConfig;
   assertEquals(true, config.compression());
   
   EmbeddedCacheManager cacheManager = new DefaultCacheManager(globalConfig);

   cacheManager.defineConfiguration("testCache", cacheConfig);

   cacheManager.start();
   Cache<String, String> cache = cacheManager.getCache("testCache");

   cache.put("hello", "there");
   cache.stop();
   cacheManager.stop();
}
 
开发者ID:saturnism,项目名称:infinispan-cachestore-offheap,代码行数:24,代码来源:ConfigurationTest.java

示例5: main

import org.infinispan.Cache; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, InterruptedException {
	
     
      // Initialize the cache manager
	DefaultCacheManager cacheManager = new DefaultCacheManager("config/beosbank-infinispan.xml");
      // Obtain the default cache
      Cache<Long, MoneyTransfert> cache = cacheManager.getCache("beosbank-dist");
      
      
	// Obtain the remote cache
	cache.addListener(new DatagridListener());
	// Create a Money Transfer Object from XML Message using BeaoIO API
	try {
		BeosBankCacheUtils.loadEntries(cache,inputFileNames);
		// Inspect the cache .
		System.out.println(cache.size());
		Thread.sleep(2000);
		cache.get(5l);
		System.out.println("Cache content after 2 sec");
		//Current node content
		printCacheContent(cache);
		
		Thread.sleep(1000);
		System.out.println("Cache content after 3 sec");
		printCacheContent(cache);
		
		Thread.sleep(3000);
		System.out.println("Cache content after 6 sec");
		printCacheContent(cache);
		
		// Stop the cache
		cache.stop();

	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

}
 
开发者ID:PacktPublishing,项目名称:JBoss-Developers-Guide,代码行数:40,代码来源:ExpirationXmlConfiguration.java

示例6: main

import org.infinispan.Cache; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, InterruptedException {
	
      //Configuration
	ConfigurationBuilder builder = new ConfigurationBuilder();
	builder
		.eviction()
		.strategy(EvictionStrategy.LRU)
		.type(EvictionType.COUNT)
		.size(3)
		;
      // Initialize the cache manager
	DefaultCacheManager cacheManager = new DefaultCacheManager(builder.build());
    // Obtain the default cache
    Cache<Long, MoneyTransfert> cache = cacheManager.getCache("beosbank-dist");
      
	// Obtain the remote cache
	cache.addListener(new DatagridListener());
	// Create a Money Transfer Object from XML Message using BeaoIO API
	try {
		BeosBankCacheUtils.loadEntries(cache,inputFileNames);

		// Inspect the cache .
		System.out.println(cache.size());
		System.out.println(cache.get(3l));
		
		//Current node content
		cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP)
        .entrySet().forEach(entry -> System.out.printf("%s = %s\n", entry.getKey(), entry.getValue().getDescription()));
		
		// Stop the cache
		cache.stop();

	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

}
 
开发者ID:PacktPublishing,项目名称:JBoss-Developers-Guide,代码行数:39,代码来源:EvictionDemo.java

示例7: main

import org.infinispan.Cache; //导入方法依赖的package包/类
public static void main(String[] args) {

		String[] inputFileNames = { "data1.xml", "data2.xml", "data3.xml", "data4.xml", "data5.xml" };
		// Create a Money Transfer Object from XML Message using BeaoIO API
		try {
			StreamFactory factory = StreamFactory.newInstance();
			factory.loadResource("mapping.xml");
			Unmarshaller unmarshaller = factory.createUnmarshaller("MoneyTransferStream");

			String record;
			ConfigurationBuilder builder = new ConfigurationBuilder();
			Cache<String, Object> cache = new DefaultCacheManager(builder.build()).getCache();
			
			//Read Transactions and put in cache
			for (String inputFile : inputFileNames) {
				record = FileUtils.getContentsAsString(new File(INPUT_DIR + inputFile));
				MoneyTransfert mt = (MoneyTransfert) unmarshaller.unmarshal(record);
				cache.put(mt.getId() + "", mt);
			}

			//Inspect the cache .
			System.out.println(cache.size());
			System.out.println(cache.getStatus());
			System.out.println(cache.get("3"));

			//Stop the cache
			cache.stop();
			System.out.println(cache.getStatus());

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
 
开发者ID:PacktPublishing,项目名称:JBoss-Developers-Guide,代码行数:36,代码来源:EmbeddedCacheDemo.java

示例8: main

import org.infinispan.Cache; //导入方法依赖的package包/类
public static void main(String[] args) {

		String[] inputFileNames = { "data1.xml", "data2.xml", "data3.xml", "data4.xml", "data5.xml" };
		// Create a Money Transfer Object from XML Message using BeaoIO API
		try {
			StreamFactory factory = StreamFactory.newInstance();
			factory.loadResource("mapping.xml");
			Unmarshaller unmarshaller = factory.createUnmarshaller("MoneyTransferStream");

			String record;
			ConfigurationBuilder builder = new ConfigurationBuilder();
			Cache<String, Object> cache = new DefaultCacheManager(builder.build()).getCache();
			
			cache.addListener(new DatagridListener());
			//Read Transactions and put in cache
			for (String inputFile : inputFileNames) {
				record = FileUtils.getContentsAsString(new File(INPUT_DIR + inputFile));
				MoneyTransfert mt = (MoneyTransfert) unmarshaller.unmarshal(record);
				cache.put(mt.getId() + "", mt);
			}

			//Inspect the cache .
			System.out.println(cache.size());
			System.out.println(cache.getStatus());
			System.out.println(cache.get("3"));

			//Stop the cache
			cache.stop();
			System.out.println(cache.getStatus());

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
 
开发者ID:PacktPublishing,项目名称:JBoss-Developers-Guide,代码行数:37,代码来源:EmbeddedCacheListenerDemo.java

示例9: removeCache

import org.infinispan.Cache; //导入方法依赖的package包/类
protected void removeCache(Cache<?,?> cache) {
	iCacheManager.getGlobalComponentRegistry().removeCache(cache.getName());
	CacheJmxRegistration jmx = cache.getAdvancedCache().getComponentRegistry().getComponent(CacheJmxRegistration.class);
	cache.stop();
	if (jmx != null)
		jmx.unregisterCacheMBean();
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:8,代码来源:ReplicatedServerWithMaster.java

示例10: textXmlConfigLegacy

import org.infinispan.Cache; //导入方法依赖的package包/类
@Test(enabled = false, description = "ISPN-3388")
public void textXmlConfigLegacy() throws IOException {
   EmbeddedCacheManager cacheManager = new DefaultCacheManager("config/leveldb-config-legacy-" +
         LevelDBStoreConfiguration.ImplementationType.AUTO.toString().toLowerCase() + ".xml");
   Cache<String, String> cache = cacheManager.getCache("testCache");

   cache.put("hello", "there legacy xml");
   cache.stop();
   cacheManager.stop();

   TestingUtil.recursiveFileRemove("/tmp/leveldb/legacy");
}
 
开发者ID:danberindei,项目名称:infinispan-cachestore-leveldb,代码行数:13,代码来源:ConfigurationTest.java

示例11: testXmlConfig60

import org.infinispan.Cache; //导入方法依赖的package包/类
public void testXmlConfig60() throws IOException {
   EmbeddedCacheManager cacheManager = new DefaultCacheManager("config/leveldb-config-60-" +
         LevelDBStoreConfiguration.ImplementationType.AUTO.toString().toLowerCase() + ".xml");

   Cache<String, String> cache = cacheManager.getCache("testCache");

   cache.put("hello", "there 60 xml");
   cache.stop();
   cacheManager.stop();

   TestingUtil.recursiveFileRemove("/tmp/leveldb/60");
}
 
开发者ID:danberindei,项目名称:infinispan-cachestore-leveldb,代码行数:13,代码来源:ConfigurationTest.java

示例12: testXmlConfig60

import org.infinispan.Cache; //导入方法依赖的package包/类
public void testXmlConfig60() throws IOException {
   EmbeddedCacheManager cacheManager = new DefaultCacheManager("config/mapdb-config-60.xml");

   Cache<String, String> cache = cacheManager.getCache("testCache");

   cache.put("hello", "there 60 xml");
   cache.stop();
   cacheManager.stop();
}
 
开发者ID:saturnism,项目名称:infinispan-cachestore-mapdb,代码行数:10,代码来源:ConfigurationTest.java

示例13: testXmlConfig

import org.infinispan.Cache; //导入方法依赖的package包/类
public void testXmlConfig() throws IOException {
   EmbeddedCacheManager cacheManager = new DefaultCacheManager("config.xml");
   Cache<String, String> cache = cacheManager.getCache("cassandracache");
   cache.put("Hello", "Moon");
   assertEquals(cache.get("Hello"), "Moon");
   cache.stop();
   cacheManager.stop();
}
 
开发者ID:infinispan,项目名称:infinispan-cachestore-cassandra,代码行数:9,代码来源:CassandraConfigurationTest.java

示例14: testCustomStoreConfig

import org.infinispan.Cache; //导入方法依赖的package包/类
public void testCustomStoreConfig() throws IOException {
   EmbeddedCacheManager cacheManager = new DefaultCacheManager("customstore-config.xml");
   Cache<String, String> cache = cacheManager.getCache("cassandracache");
   cache.put("Hi", "there");
   assertEquals(cache.get("Hi"), "there");
   cache.stop();
   cacheManager.stop();
}
 
开发者ID:infinispan,项目名称:infinispan-cachestore-cassandra,代码行数:9,代码来源:CassandraConfigurationTest.java

示例15: testXmlConfig60

import org.infinispan.Cache; //导入方法依赖的package包/类
public void testXmlConfig60() throws IOException {
   EmbeddedCacheManager cacheManager = new DefaultCacheManager("config/offheap-config-60.xml");

   Cache<String, String> cache = cacheManager.getCache("testCache");

   cache.put("hello", "there 52 xml");
   cache.stop();
   cacheManager.stop();
}
 
开发者ID:saturnism,项目名称:infinispan-cachestore-offheap,代码行数:10,代码来源:ConfigurationTest.java


注:本文中的org.infinispan.Cache.stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。