本文整理汇总了Java中org.infinispan.client.hotrod.RemoteCache.stop方法的典型用法代码示例。如果您正苦于以下问题:Java RemoteCache.stop方法的具体用法?Java RemoteCache.stop怎么用?Java RemoteCache.stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.infinispan.client.hotrod.RemoteCache
的用法示例。
在下文中一共展示了RemoteCache.stop方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeOnCache
import org.infinispan.client.hotrod.RemoteCache; //导入方法依赖的package包/类
private static <K, V> int executeOnCache(RemoteCacheRunnable<K, V> runnable, Map<Argument, String> map) throws Exception {
RemoteCacheManager remoteCacheManager = new RemoteCacheManager(map.get(Argument.HOST),
Integer.parseInt(map.get(Argument.PORT)));
RemoteCache<K, V> remoteCache = remoteCacheManager.getCache(map.get(Argument.CACHE_NAME));
try {
if (remoteCache == null) {
System.err.println("Unable to connect to cache");
return -1;
}
return runnable.execute(remoteCache, map);
} finally {
if (remoteCache != null) {
remoteCache.stop();
}
remoteCacheManager.stop();
}
}
示例2: main
import org.infinispan.client.hotrod.RemoteCache; //导入方法依赖的package包/类
public static void main(String[] args) {
// Create a configuration for a locally-running server
ConfigurationBuilder builder = new ConfigurationBuilder();
int BeosBankCacheAfricaPort = 11322;
builder.addServer().host("127.0.0.1").port(BeosBankCacheAfricaPort);
// Connect to the server
RemoteCacheManager cacheManager = new RemoteCacheManager(builder.build());
// Obtain the remote cache
RemoteCache<String, Object> cache = cacheManager.getCache("beosbank-repl");
cache.addClientListener(new DatagridClientListener());
// 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;
// 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.get("3"));
// Stop the cache
cache.stop();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例3: main
import org.infinispan.client.hotrod.RemoteCache; //导入方法依赖的package包/类
public static void main(String[] args) {
// Create a configuration for a locally-running server
ConfigurationBuilder builder = new ConfigurationBuilder();
int BeosBankCacheAfricaPort = 11322;
builder.addServer().host("127.0.0.1").port(BeosBankCacheAfricaPort);
// Connect to the server
RemoteCacheManager cacheManager = new RemoteCacheManager(builder.build());
// Obtain the remote cache
RemoteCache<String, Object> cache = cacheManager.getCache();
cache.addClientListener(new DatagridClientListener());
// 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;
// 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.get("3"));
// Stop the cache
cache.stop();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例4: main
import org.infinispan.client.hotrod.RemoteCache; //导入方法依赖的package包/类
public static void main(String[] args) {
// Create a configuration for a locally-running server
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.addServer().host("127.0.0.1").port(ConfigurationProperties.DEFAULT_HOTROD_PORT);
// Connect to the server
RemoteCacheManager cacheManager = new RemoteCacheManager(builder.build());
// Obtain the remote cache
RemoteCache<String, Object> cache = cacheManager.getCache();
cache.addClientListener(new DatagridClientListener());
// 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;
// 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.get("3"));
// Stop the cache
cache.stop();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例5: main
import org.infinispan.client.hotrod.RemoteCache; //导入方法依赖的package包/类
public static void main(String[] args) {
// Create a configuration for a locally-running server
ConfigurationBuilder builder = new ConfigurationBuilder();
int BeosBankCacheAfricaPort = 11322;
builder.addServer().host("127.0.0.1").port(BeosBankCacheAfricaPort);
// Connect to the server
RemoteCacheManager cacheManager = new RemoteCacheManager(builder.build());
// Obtain the remote cache
RemoteCache<String, Object> cache = cacheManager.getCache("beosbank-repl");
cache.addClientListener(new DatagridClientListener());
// 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;
// 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.get("3"));
// Stop the cache
cache.stop();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例6: main
import org.infinispan.client.hotrod.RemoteCache; //导入方法依赖的package包/类
public static void main(String[] args) {
// Create a configuration for a locally-running server
ConfigurationBuilder builder = new ConfigurationBuilder();
int BeosBankCacheAfricaPort = 11322;
builder.addServer().host("127.0.0.1").port(BeosBankCacheAfricaPort);
// Connect to the server
RemoteCacheManager cacheManager = new RemoteCacheManager(builder.build());
// Obtain the remote cache
RemoteCache<String, Object> cache = cacheManager.getCache("beosbank-repl");
cache.addClientListener(new DatagridClientListener());
// 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;
// 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.get("3"));
// Stop the cache
cache.stop();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例7: main
import org.infinispan.client.hotrod.RemoteCache; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Map<Argument, String> map = new EnumMap<Argument, String>(Argument.class);
Queue<String> queue = new LinkedList<String>(Arrays.asList(args));
Argument.setDefaultValues(map);
while (!queue.isEmpty()) {
Argument.parse(queue, map);
}
if (map.containsKey(Argument.HELP)) {
System.out.println("The following arguments are allowed:");
for (Argument argument : Argument.values()) {
System.out.println(Argument.help(argument));
}
System.exit(0);
}
String filePath = map.get(Argument.FILE);
if (filePath == null) {
System.err.println(Argument.FILE.getArg() + " is missing!");
System.exit(1);
}
File file = new File(filePath);
if (!file.exists()) {
System.err.println("File '" + filePath + "' not found!");
System.exit(1);
}
BufferedReader reader = new BufferedReader(new FileReader(file));
RemoteCacheManager remoteCacheManager = new RemoteCacheManager(map.get(Argument.HOST),
Integer.parseInt(map.get(Argument.PORT)));
RemoteCache<Integer, String> remoteCache = remoteCacheManager.getCache(map.get(Argument.CACHE_NAME));
String line;
int lineNumber = 1;
System.out.println();
while ((line = reader.readLine()) != null) {
remoteCache.put(lineNumber++, line);
if (lineNumber % 100 == 0) {
System.out.printf("\rLine " + lineNumber + " added!");
}
}
System.out.println();
reader.close();
remoteCache.stop();
remoteCacheManager.stop();
System.exit(0);
}