Package org.jgroups

Examples of org.jgroups.JChannel.connect()


         try {
             routerPort = Utilities.startGossipRouter();
             String props=getTUNNELProps(routerPort, routerPort);
             // String props="tunnel.xml";
             JChannel coordinator=new JChannel(props);
             coordinator.connect("testgroup");
             channel=new JChannel(props);
             channel.connect("testgroup1");
             channel.disconnect();
             channel.connect("testgroup");
View Full Code Here


            routerPort = Utilities.startGossipRouter();
            String props=getTUNNELProps(routerPort, routerPort);

            final Promise msgPromise=new Promise();
            JChannel coordinator=new JChannel(props);
            coordinator.connect("testgroup");
            PullPushAdapter ppa=
                    new PullPushAdapter(coordinator,
                                        new PromisedMessageListener(msgPromise));
            ppa.start();
View Full Code Here

      Properties p = newGC.getTransportProperties();
      String jgroupsCfg = p.getProperty(JGroupsTransport.CONFIGURATION_STRING);
      try {
         JChannel channel = new JChannel(jgroupsCfg);
         channel.setName(newGC.getTransportNodeName());
         channel.connect(newGC.getClusterName());
         return channel;
      } catch (Exception e) {
         throw new CacheException(e);
      }
   }
View Full Code Here

            help();
            return;
        }
        try {
            channel=new JChannel(props);
            channel.connect("ReplicatedHashMapDemo-Cluster");
            client.start(channel);
        }
        catch(Throwable t) {
            t.printStackTrace();
        }
View Full Code Here

                    ch.setReceiver(new ReceiverAdapter() {
                        public void receive(Message msg) {
                            System.out.println("[" + topic + "] << " + msg.getObject());
                        }
                    });
                    ch.connect(topic);
                    topics.put(topic, ch);
                    System.out.println("subscribed to topic \"" + topic + "\"; current subscriptions: " + topics.keySet());
                }
                continue;
            }
View Full Code Here

            public void receive(Message msg) {
                System.out.println("<< " + msg.getObject() + " [" + msg.getSrc() + "]");
            }
        });

        ch.connect("ChatCluster");


        for(;;) {
            String line=Util.readStringFromStdin(": ");
            ch.send(null, line);
View Full Code Here

                    int index=tmp.indexOf(':');
                    props=LOOPBACK + tmp.substring(index);
                }
                channel=new JChannel(props);
                // System.out.println("props:\n" + channel.getProperties());
                channel.connect(group_name);
            }
            else {
                group_addr=InetAddress.getByName("224.0.0.36");
                sock=new DatagramSocket();
            }
View Full Code Here

    private void start(boolean sender, boolean local, String props) throws Exception {
        if(local) {
            JChannel ch1, ch2;
            ch1=new JChannel(props);
            ch1.connect("x");
            ch2=new JChannel(props);
            ch2.setReceiver(new MyReceiver());
            ch2.connect("x");
            for(int i=0; i < 10; i++) {
                ch1.send(new Message(null, null, System.currentTimeMillis()));
View Full Code Here

            public void triggerFlush() {
                log.info("Joining D, this will trigger FLUSH and a subsequent view change to {A,B,C,D}");
                JChannel newChannel;
                try{
                    newChannel = createChannel();
                    newChannel.connect("x");
                    channels.add(newChannel);
                }catch(Exception e){
                    e.printStackTrace();
                }
            };
View Full Code Here

            JChannel channel = createChannel();
            MyReceiver r = new MyReceiver(channel, names[i]);
            receivers.add(r);
            channels.add(channel);
            channel.setReceiver(r);
            channel.connect("x");
            Util.sleep(250);
        }
        JChannel last = channels.get(channels.size() - 1);
        JChannel nextToLast = channels.get(channels.size() - 2);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.