Package org.jgroups

Examples of org.jgroups.JChannel$MyProbeHandler


      Cache<String, String> cache1 = createCache();
      Cache<String, String> cache2 = createCache();

      Configuration conf = UnitTestConfigurationFactory.getEmptyConfiguration();

      JChannel ch1 = new JChannel(conf.getClusterConfig());
      cache1.getConfiguration().getRuntimeConfig().setChannel(ch1);

      JChannel ch2 = new JChannel(conf.getClusterConfig());
      cache2.getConfiguration().getRuntimeConfig().setChannel(ch2);

      cache1.start();
      cache2.start();
View Full Code Here


        long start, stop;

        int num_expected_msgs=num_threads * num_msgs * buddies;
        int num_total_msgs=num_channels * num_threads * num_msgs; // over all channels
        for(int i=0; i < channels.length; i++) {
            channels[i]=new JChannel(props);
            receivers[i]=new Receiver(terminate_barrier, bytes_received, msgs_received, num_expected_msgs, num_total_msgs);
            dispatchers[i]=new RpcDispatcher(channels[i], null, null, receivers[i]);
            channels[i].connect("x");
        }

        // start the senders
        for(int i=0; i < channels.length; i++) {
            JChannel channel=channels[i];
            View view=channel.getView();
            Vector<Address> members=view.getMembers();
            if(members.size() != num_channels) {
                throw new Exception("cluster has not formed correctly, expected " + num_channels + " channels, found" +
                        " only " + members.size() + " (view: " + view + ")");
            }
            Vector<Address> tmp=pickBuddies(members, channel.getAddress());

            for(int j=0; j < num_threads; j++) {
                Sender sender=new Sender(start_barrier, msg_size, num_msgs, dispatchers[i], channel.getAddress(), tmp);
                sender.start(); // will wait on barrier
            }
        }

        System.out.println("sending " + num_total_msgs + " msgs with " + num_threads + " threads over " + num_channels + " channels");
View Full Code Here

    /**
     * Tests connect-disconnect-connect sequence for a group with two members (using default
     * configuration).
     **/
    public void testDisconnectConnectTwo() throws Exception {
        coordinator = new JChannel(props);
        channel = new JChannel(props);
        coordinator.connect(GROUP);
        channel.connect("DisconnectTest.testgroup-1");
        channel.disconnect();
        channel.connect(GROUP);
        View view = channel.getView();
View Full Code Here

        assert view.containsMember(channel.getAddress());
        assert view.containsMember(coordinator.getAddress());
    }
   
    public void testAddInitialHosts() throws Exception {
        coordinator = new JChannel(props);
        channel = new JChannel(props);
        coordinator.connect(GROUP);
        channel.connect(GROUP);
        TCPGOSSIP p = (TCPGOSSIP) channel.getProtocolStack().findProtocol(TCPGOSSIP.class);
        String bind_addr = getRouterBindAddress();
        assert p.removeInitialHost(bind_addr, 12001);
View Full Code Here

        assert view.containsMember(channel.getAddress());
        assert view.containsMember(coordinator.getAddress());
    }

    public void testConnectThree() throws Exception {
        JChannel third = null;
        try {
            coordinator = new JChannel(props);
            channel = new JChannel(props);
            coordinator.connect(GROUP);
            channel.connect(GROUP);
            third = new JChannel(props);
            third.connect(GROUP);
            View view = channel.getView();
            assert channel.getView().size() == 3;
            assert third.getView().size() == 3;
            assert view.containsMember(channel.getAddress());
            assert view.containsMember(coordinator.getAddress());
        } finally {
            Util.close(third);
        }
View Full Code Here

            Util.close(third);
        }
    }

    public void testConnectThreeChannelsWithGRDown() throws Exception {
        JChannel third = null;
        try {
            coordinator = new JChannel(props);
            channel = new JChannel(props);
            coordinator.connect("testConnectThreeChannelsWithGRDown");
            channel.connect("testConnectThreeChannelsWithGRDown");

            // kill router
            gossipRouter.stop();
           

            // cannot discover others since GR is down
            third = new JChannel(props);
            third.connect("testConnectThreeChannelsWithGRDown");
          

            // restart and....
            gossipRouter.start();
            Util.blockUntilViewsReceived(60000, 500, coordinator, channel, third);

            // confirm they found each other
            View view = channel.getView();
            assert channel.getView().size() == 3;
            assert third.getView().size() == 3;
            assert view.containsMember(channel.getLocalAddress());
            assert view.containsMember(coordinator.getLocalAddress());
        } finally {
            Util.close(third);
        }
View Full Code Here

            Util.close(third);
        }
    }

    public void testConnectThreeChannelsWithGRAlreadyDown() throws Exception {
        JChannel third = null;
        try {
            coordinator = new JChannel(props);
            channel = new JChannel(props);
           
            // kill router
            gossipRouter.stop();
           
            // cannot discover others since GR is down
            coordinator.connect("testConnectThreeChannelsWithGRAlreadyDown");         
            channel.connect("testConnectThreeChannelsWithGRAlreadyDown");

            third = new JChannel(props);
            third.connect("testConnectThreeChannelsWithGRAlreadyDown");

            // restart and....
            gossipRouter.start();
            Util.blockUntilViewsReceived(60000, 500, coordinator, channel, third);

            // confirm they found each other
            View view = channel.getView();
            assert channel.getView().size() == 3;
            assert third.getView().size() == 3;
            assert view.containsMember(channel.getLocalAddress());
            assert view.containsMember(coordinator.getLocalAddress());
        } finally {
            Util.close(third);
        }
View Full Code Here

    private Sender[]    senders=new Sender[NUM_THREADS];


    @BeforeMethod
    void setUp() throws Exception {
        c1=new JChannel(props);
        c1.setName("A");
        c1.connect(GROUP);
        r1=new MyReceiver("A");
        c1.setReceiver(r1);

        c2=new JChannel(props);
        c2.setName("B");
        c2.connect(GROUP);
        r2=new MyReceiver("B");
        c2.setReceiver(r2);

        c3=new JChannel(props);
        c3.setName("C");
        c3.connect(GROUP);
        r3=new MyReceiver("C");
        c3.setReceiver(r3);
View Full Code Here

        }

        public void run() {
            for(int i=1; i <= num_msgs; i++) {
                try {
                    JChannel ch=(JChannel)Util.pickRandomElement(channels);
                    String channel_name=ch.getName();
                    ch.send(null, null, channel_name + ":" + num.getAndIncrement());
                }
                catch(Exception e) {
                }
            }
        }
View Full Code Here

            "print_local_addr=true)";

    @Test(groups=Global.FUNCTIONAL)
    public static void testMyProtocol() throws Exception {
        System.out.println("PROTOCOL_STACK: " + PROTOCOL_STACK);
        JChannel channel = new JChannel(PROTOCOL_STACK);
        System.out.println("channel = " + channel);
        assert true;
    }
View Full Code Here

TOP

Related Classes of org.jgroups.JChannel$MyProbeHandler

Copyright © 2018 www.massapicom. 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.