Hi
Just started looking at infinispan, so probably making a simple mistake. I have downloaded 4.2.0.BETA1 and tried the GUI demo and it worked fine.
However when I wrote a simple test, I don't seem to be able to share the values across two instances of the app. I got the code snippet for creating the cache from the DZone ref card, and just added some additional code to access and update the value:
GlobalConfiguration globalConf = GlobalConfiguration.getClusteredDefault();
Configuration cfg = new Configuration();
cfg.setCacheMode(Configuration.CacheMode.DIST_SYNC);
DefaultCacheManager m = new DefaultCacheManager(globalConf, cfg);
Cache<String, String> cache = m.getCache();
String key="hello";
System.out.println("waiting to read...");
System.in.read();
System.out.println("GET "+key+"="+cache.get(key));
System.out.println("waiting to update...");
System.in.read();
cache.put(key, "world");
System.out.println("GET AGAIN "+key+"="+cache.get(key));
System.out.println("waiting to exit...");
System.in.read();
So I run one instance:
log4j:WARN No appenders could be found for logger (org.infinispan.factories.GlobalComponentRegistry).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
waiting to read...
GET hello=null
waiting to update...
GET AGAIN hello=world
waiting to exit...
and then another instance:
log4j:WARN No appenders could be found for logger (org.infinispan.factories.GlobalComponentRegistry).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
waiting to read...
GET hello=null
waiting to update...
Any idea what I'm doing wrong?
Regards
Gary