package com.hp.uup.cache.examples; import java.io.IOException; import org.infinispan.Cache; import org.infinispan.manager.DefaultCacheManager; import org.infinispan.manager.EmbeddedCacheManager; public class EmbeddedCacheClusterNode2 { /** * @param args */ public static void main(String[] args) { Cache objCache=null;; try{ EmbeddedCacheManager manager= new DefaultCacheManager("/home/bea/Infinispan/infinispan-4.2.0.FINAL/config/Cache-config-file3.xml"); objCache=manager.getCache("JDBCPassivateEvictCache"); System.out.println("putting keys from 1100 to 1199 in Node2 Cache"); for(int i=1100;i<=1199;i++) { objCache.put("Key"+i, "value"+i); System.out.println("Creating :"+"Key"+i); } System.out.println("******* Waiting for 1 min***\n"); try { Thread.sleep(60000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("******* Waking up **********\n"); System.out.println("Reading the keys inserted in Node1"); for(int i=1001;i<=1099;i++) { System.out.println("getting :"+"Key"+i+" Value="+objCache.get("Key"+i)); } System.out.println("******* Waiting for 1 min***\n"); try { Thread.sleep(60000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("******* Waking up **********\n"); System.out.println("trying again to read to read the keys inserted in Node1"); for(int i=1001;i<=1099;i++) { System.out.println("getting :"+"Key"+i+" Value="+objCache.get("Key"+i)); } System.out.println("*** Completed ***"); } catch(IOException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }