1 Reply Latest reply: Jul 17, 2012 1:10 PM by Vladimir Blagojevic RSS

Not able to communicate between clusters

Aditya Lele Newbie

I have set up a simple cache

 

 

 

package org.adix;

 

 

import java.io.*;

 

 

import org.infinispan.Cache;

import org.infinispan.configuration.global.GlobalConfiguration;

import org.infinispan.configuration.global.GlobalConfigurationBuilder;

import org.infinispan.manager.DefaultCacheManager;

 

 

@SuppressWarnings("deprecation")

public class cluster {

 

 

          /**

           * @param args

           */

 

          public static void main(String[] args) throws IOException {

                    // TODO Auto-generated method stub

 

 

                    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

                    String a,b;

                    int opt=0;

 

                    GlobalConfiguration gc = new GlobalConfigurationBuilder().transport().defaultTransport().addProperty("configurationFile", "jgroups-tcp.xml").build();

                    DefaultCacheManager m = new DefaultCacheManager(gc);

                    Cache <String, String> c= m.getCache();

 

 

                    System.out.println("wana continue?");

                    while(in.readLine()!="n"){

                              System.out.println("1 for entries 2 for query");

                              opt=Integer.parseInt(in.readLine());

                              if(opt==1){

                                        System.out.println("Enter key");

                                        a=in.readLine();

                                        System.out.println("Enter val");

                                        b=in.readLine();

                                        c.put(a,b);

                              }

                              else if(opt==2){

                                        System.out.println("Enter key");

                                        a=in.readLine();

                                        System.out.println(c.get(a));

                              }

                    }

          }

 

 

}

 

 

 

when i run two instances of the program in eclipse I can see a cluster beng formed but if I add any data in cache from one instance its not reflected in the second instance.

 

Im using infinispan 5.1.5

 

Why can't I read the data from the second instance and how do I do that?