本文整理匯總了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
示例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");
}
示例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");
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}