From: Bela B. <be...@ya...> - 2002-11-06 22:47:48
|
Could this be a classloader problem ? E.g. the first member is run by a different classloader than the second member, so serialization will fail ? Any servlet container experts ? I suggest you enable full tracing for JavaGroups, to see eventual error messages. Vincent Shek wrote: > Hi all, > > I was able to use Javagroup sucessfully when I ran 2 processes on my > Windows > 2000 console. In my example below, when I started Test1 and started Test2 > later on, the two processes were able to see each other and Test1 > would see > the Hashtable insert(s) performed by Test2. > > However, if I leave Test1 running and run my Test2 program as a jsp inside > Tomcat or Weblogic, the Hashtable insert performed within Tomcat would > never > show up in my Test1 process running on the console. > > Any help on this is much appreciated! I was trying to use Javagroup as a > distributed caching mechanism within Tomcat and Weblogic server. > > > Vincent Shek > > ////////////////////////////// process 1 /////////////////////////// > > import org.javagroups.*; > import org.javagroups.blocks.*; > import org.javagroups.log.Trace; > > > public class Test1 extends Thread implements > DistributedHashtable.Notification { > > DistributedHashtable h; > > private final String groupname="testgroup"; > > public static void main(String args[]) { > > String props="UDP(mcast_addr=228.8.8.8;mcast_port=45566;" + > "ucast_send_buf_size=32000;ucast_recv_buf_size=64000;" + > "mcast_send_buf_size=32000;mcast_recv_buf_size=64000;" + > "use_packet_handler=false;loopback=true;ip_ttl=32):" + > "PING(timeout=2000;num_initial_members=3):" + > "MERGE2(min_interval=5000;max_interval=10000):" + > "FD_SOCK:" + > "VERIFY_SUSPECT(timeout=1500):" + > "pbcast.STABLE(desired_avg_gossip=20000):" + > > "pbcast.NAKACK(gc_lag=50;retransmit_timeout=300,600,1200,2400,4800;max_xmit_ > size=5192):" + > "UNICAST(timeout=5000):" + > "FRAG(frag_size=8192;down_thread=false;up_thread=false):" + > "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;" + > "shun=false;print_local_addr=true):" + > "pbcast.STATE_TRANSFER"; > > ChannelFactory factory=new JChannelFactory(); > > Test1 t = new Test1(factory, props); > t.start(); > > } > > public Test1 (ChannelFactory factory, String props) { > h=new DistributedHashtable(groupname, factory, props, 0); > h.addNotifier(this); > } > > public void run() { > while (true) { > try { > sleep(10000); > Collection a = h.values(); > Iterator i = a.iterator(); > while (i.hasNext()) { > System.out.println(i.next()); > } > } catch (InterruptedException e) {} > } > } > > > public void viewChange(Vector joined, Vector left) { > System.out.println("New members: " + joined + ", left members: " > + left); > } > > public void entrySet(Object key, Object value) { > System.out.println("Key: " + Key + ", value: " + value); > } > > public void entryRemoved(Object key) { > } > } > > ////////////////////////////// process 2 /////////////////////////// > import org.javagroups.*; > import org.javagroups.blocks.*; > import org.javagroups.log.Trace; > > > public class Test2 { > > DistributedHashtable h; > private final String groupname="testgroup"; > > public static void main(String args[]) { > > String props="UDP(mcast_addr=228.8.8.8;mcast_port=45566;" + > "ucast_send_buf_size=32000;ucast_recv_buf_size=64000;" + > "mcast_send_buf_size=32000;mcast_recv_buf_size=64000;" + > "use_packet_handler=false;loopback=true;ip_ttl=32):" + > "PING(timeout=2000;num_initial_members=3):" + > "MERGE2(min_interval=5000;max_interval=10000):" + > "FD_SOCK:" + > "VERIFY_SUSPECT(timeout=1500):" + > "pbcast.STABLE(desired_avg_gossip=20000):" + > > "pbcast.NAKACK(gc_lag=50;retransmit_timeout=300,600,1200,2400,4800;max_xmit_ > size=5192):" + > "UNICAST(timeout=5000):" + > "FRAG(frag_size=8192;down_thread=false;up_thread=false):" + > "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;" + > "shun=false;print_local_addr=true):" + > "pbcast.STATE_TRANSFER"; > > ChannelFactory factory=new JChannelFactory(); > > Test2 t = new Test2(factory, props); > } > > public Test2 (ChannelFactory factory, String props) { > > h=new DistributedHashtable(groupname, factory, props, 0); > h.put("test1", "test1"); > } > } > -- Bela Ban http://www.javagroups.com Cell: (408) 316-4459 |