default cache not updated by hotrod client ?
dmc-dev Apr 21, 2014 8:28 AMI am just getting started with infinispan version 6.0.2.Final,
I can created a 2 node cluster, running the servers using ./cluster.sh
I can see in the logs that the cluster has formed
14:43:30,955 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (Incoming-1,shared=udp) ISPN000094: Received new cluster view: [dev2/clustered|1] (2) [dev2/clustered, dev4/clustered]
Then using the command line tool, I can interact with the default cache from either node, and changes are reflected as expected.
I have written a very simple Client, to connect to the remote cluster, and interact with the default cache. from the logs, it looks like the client is connect to the cluster.
however the changes made by the client to the default cache, are not reflected on any server node ?
What is it I am doing wrong ?
client invocation
java -jar infini2-binding-0.1.4.jar 192.168.2.102 default
out put
com.yahoo.ycsb.db.infini2.SimpleInfinispanClient
Apr 21, 2014 3:18:22 PM org.infinispan.client.hotrod.impl.protocol.Codec10 readNewTopologyAndHash
INFO: ISPN004006: /192.168.2.102:11222 sent new topology view (id=2) containing 2 addresses: [/192.168.2.102:11222, /192.168.2.104:11222]
Apr 21, 2014 3:18:22 PM org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory updateServers
INFO: ISPN004014: New server added(/192.168.2.104:11222), adding to the pool.
Apr 21, 2014 3:18:22 PM org.infinispan.client.hotrod.RemoteCacheManager start
INFO: ISPN004021: Infinispan version: null
before0==>value0
after0==>value0
before1==>value1
after1==>value1
before2==>value2
after2==>value2
before3==>value3
.......
Client Code
public class SimpleInfinispanClient{
public RemoteCacheManager remoteCacheManager;
public SimpleInfinispanClient(String hostPort) {
System.err.println(this.getClass().getName());
remoteCacheManager = new RemoteCacheManager(hostPort);
}
public void insert(String table, String key, String value) {
RemoteCache<String, String> cache = remoteCacheManager.getCache(table);
cache.put(key, value);
}
public String read(String table, String key) {
RemoteCache<String, String> cache = remoteCacheManager.getCache(table);
return cache.get(key);
}
public int size(String table) {
RemoteCache<String, String> cache = remoteCacheManager.getCache(table);
return cache.size();
}
public static void main(String[] args){
SimpleInfinispanClient c = new SimpleInfinispanClient(args[0]);
String table = args[1];
for(int i=0; i<10; i++){
String val = c.read(table, Integer.toString(i));
System.err.println("before"+i+"==>"+val);
c.insert(table, Integer.toString(i), "value"+i);
val = c.read(table, Integer.toString(i));
System.err.println("after"+i+"==>"+val);
}
}
}