Package org.jgroups

Examples of org.jgroups.JChannel


      * DISCONNECT. Because of this problem, the channel couldn't be used to
      * multicast messages.
      **/
     public void testDisconnectConnectSendTwo_TUNNEL() throws Exception {
        final Promise<Message> msgPromise=new Promise<Message>();
        coordinator=new JChannel(props);
        setProps(coordinator);
        coordinator.connect(GROUP);
        coordinator.setReceiver(new PromisedMessageListener(msgPromise));

        channel=new JChannel(props);
        setProps(channel);
        channel.connect("DisconnectTest.testgroup-1");
        channel.disconnect();
        channel.connect(GROUP);

View Full Code Here


public class SetPropertyTest {
    JChannel ch;

    @BeforeClass
    void init() throws ChannelException {
        ch=new JChannel();
    }
View Full Code Here

        System.out.println("-- [" + Thread.currentThread().getName() + "] " + msg);
    }


    public void testConcurrentJoinsAndLeaves() throws Exception {
        JChannel first=null;
        channel_conf="udp.xml";
       
        for(int i=0; i < threads.length; i++) {
            JChannel ch=null;
            if(i == 0) {
                ch=createChannel(true, NUM);
                first=ch;
            }
            else
                ch=createChannel(first);
            ch.setName("C" + i);
            changeProperties(ch);
            threads[i]=new MyThread(ch, i+1, barrier);
            threads[i].start();
        }
View Full Code Here

    /**
     * Tests connect with two members but when both GR fail and restart
     *
     **/
    public void testConnectTwoChannelsBothGRDownReconnect() throws Exception {
        coordinator = new JChannel(props);
        channel = new JChannel(props);
        modifyChannel(channel,coordinator);
        coordinator.connect("testConnectTwoChannelsBothGRDownReconnect");
        channel.connect("testConnectTwoChannelsBothGRDownReconnect");
        Util.sleep(1000);
        gr1.stop();
View Full Code Here

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

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

        third = new JChannel(props);
        modifyChannel(third);
        third.connect("testConnectThreeChannelsWithGRDown");
        Util.sleep(1000);
        View view = channel.getView();
        assert channel.getView().size() == 3;
        assert third.getView().size() == 3;
        assert view.containsMember(channel.getLocalAddress());
        assert view.containsMember(coordinator.getLocalAddress());

        // kill router and recheck views
        gr2.stop();
        Util.sleep(1000);

        view = channel.getView();
        assert channel.getView().size() == 3;
        assert third.getView().size() == 3;
        assert third.getView().containsMember(channel.getLocalAddress());
        assert third.getView().containsMember(coordinator.getLocalAddress());

    }
View Full Code Here

    /**
     *
      **/
    public void testConnectSendMessage() throws Exception {
        final Promise<Message> msgPromise = new Promise<Message>();
        coordinator = new JChannel(props);
        modifyChannel(coordinator);
        coordinator.connect("testConnectSendMessage");
        coordinator.setReceiver(new PromisedMessageListener(msgPromise));

        channel = new JChannel(props);
        modifyChannel(channel);
        channel.connect("testConnectSendMessage");

        channel.send(new Message(null, null, "payload"));

View Full Code Here

    /**
      *
       **/
    public void testConnectSendMessageSecondGRDown() throws Exception {
        final Promise<Message> msgPromise = new Promise<Message>();
        coordinator = new JChannel(props);
        modifyChannel(coordinator);
        coordinator.connect("testConnectSendMessageSecondGRDown");
        coordinator.setReceiver(new PromisedMessageListener(msgPromise));

        channel = new JChannel(props);
        modifyChannel(channel);
        channel.connect("testConnectSendMessageSecondGRDown");

        Util.sleep(1000);
        gr2.stop();
View Full Code Here

    /**
     *
      **/
    public void testConnectSendMessageBothGRDown() throws Exception {
        final Promise<Message> msgPromise = new Promise<Message>();
        coordinator = new JChannel(props);
        modifyChannel(coordinator);
        coordinator.connect("testConnectSendMessageBothGRDown");
        coordinator.setReceiver(new PromisedMessageListener(msgPromise));

        channel = new JChannel(props);
        modifyChannel(channel);
        channel.connect("testConnectSendMessageBothGRDown");
        Util.sleep(1000);
        gr1.stop();
        gr2.stop();
View Full Code Here

     *
      **/
    public void testConnectSendMessageBothGRDownOnlyOneUp() throws Exception {

        final Promise<Message> msgPromise = new Promise<Message>();
        coordinator = new JChannel(props);
        modifyChannel(coordinator);
        coordinator.connect("testConnectSendMessageBothGRDownOnlyOneUp");
        coordinator.setReceiver(new PromisedMessageListener(msgPromise));

        channel = new JChannel(props);
        modifyChannel(channel);
        channel.connect("testConnectSendMessageBothGRDownOnlyOneUp");
       
        Util.sleep(1000);
        gr1.stop();
View Full Code Here

    }

    public void testConnectSendMessageFirstGRDown() throws Exception {

        final Promise<Message> msgPromise = new Promise<Message>();
        coordinator = new JChannel(props);
        modifyChannel(coordinator);
        coordinator.connect("testConnectSendMessageFirstGRDown");
        coordinator.setReceiver(new PromisedMessageListener(msgPromise));

        channel = new JChannel(props);
        modifyChannel(channel);
        channel.connect("testConnectSendMessageFirstGRDown");
        Util.sleep(1000);
        gr1.stop();
View Full Code Here

TOP

Related Classes of org.jgroups.JChannel

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.