-
1. Re: Beginner needs help
mircea.markus Mar 12, 2010 8:33 AM (in response to dimar1975)I think new DefaultCacheManager() will build a local cache, that is not cluster enabled.I suggest starting with this: http://community.jboss.org/wiki/5minutetutorialonInfinispan for a quick setup of the cluster. For more detailed documentation go here: http://community.jboss.org/wiki/infinispan
-
2. Re: Beginner needs help
dimar1975 Mar 12, 2010 9:50 AM (in response to mircea.markus)Hi, thanks for your reply.
I've changed the CacheManager to use the Cluster Configuration
GlobalConfiguration gc = GlobalConfiguration.getClusteredDefault();
Configuration c = new Configuration();
c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
CacheManager manager = new DefaultCacheManager(gc, c);
}As a matter of fact I can see on both JVM the logs :
INFO: Received new cluster view: [ERMES-NB-29342|1] [ERMES-NB-29342, ERMES
-NB-15091]
12-mar-2010 15.38.32 org.infinispan.util.logging.AbstractLogImpl info
INFO: Cache local address is ERMES-NB-15091, physical addresses are [10.13.1
43.73:3166]However when I add some data from one cluster member, I cannot see anything on the other cluster member.
public Object getValue(String key) {
Cache cache = manager.getCache();
return cache.get(key);}
From a further test I discovered that if I set Cache as a global variable the data is replicated CORRECTLY.
cache = manager.getCache();
. . . . . .
public Object getValue(String key) {
return cache.get(key);}
So my last question: is it safe to declare Cache as global variable ?
Thanks alot
Ermes
-
3. Re: Beginner needs help
manik Mar 12, 2010 9:59 AM (in response to dimar1975)dimar1975 wrote:
So my last question: is it safe to declare Cache as global variable ?
Thanks alot
Ermes
Yes.