Package org.jgroups.stack

Examples of org.jgroups.stack.ProtocolStack$ProtocolStackFactory


        transport.setLoopback(b);
    }


    private static void setBundling(JChannel ch, boolean enabled, int max_bytes, long timeout) {
        ProtocolStack stack=ch.getProtocolStack();
        List<Protocol> prots=stack.getProtocols();
        TP transport=(TP)prots.get(prots.size() -1);
        transport.setEnableBundling(enabled);
        if(enabled) {
            transport.setMaxBundleSize(max_bytes);
            transport.setMaxBundleTimeout(timeout);
        }
        transport.setEnableUnicastBundling(false);
        if(enabled) {
            GMS gms=(GMS)stack.findProtocol("GMS");
            gms.setViewAckCollectionTimeout(LATENCY * 2);
            gms.setJoinTimeout(LATENCY * 2);
        }
    }
View Full Code Here


           
  List<String> order = new LinkedList<String>() ;

  @BeforeMethod
  void setUp() {
    stack=new ProtocolStack();
  }
View Full Code Here

            }
            else {
                tmp=createChannel(ch);
            }
            tmp.setName(members[i]);
            ProtocolStack stack=tmp.getProtocolStack();

            NAKACK nakack=(NAKACK)stack.findProtocol(NAKACK.class);
            if(nakack != null)
                nakack.setLogDiscardMessages(false);

            stack.removeProtocol(MERGE2.class, MERGE3.class, MERGEFAST.class);

            tmp.connect(cluster_name);
            retval[i]=tmp;
        }
View Full Code Here

        assert msg.getObject().equals("payload");
    }


    private static void changeProps(Channel ch) {
        ProtocolStack stack=ch.getProtocolStack();
        TP transport=stack.getTransport();
        transport.setLogDiscardMessages(false);
    }
View Full Code Here

    }

    public void testChannelCreation() throws Exception {
        MyReceiver receiver=new MyReceiver(null);
        c1.setReceiver(receiver);
        ProtocolStack stack=new ProtocolStack();
        c1.setProtocolStack(stack);
        stack.addProtocol(new SHARED_LOOPBACK()).addProtocol(new MockProtocol1()).addProtocol(new MockProtocol2());
        stack.init();
        c1.connect("demo");

        Protocol transport=stack.getTransport();
        transport.up(new Event(Event.MSG, new Message(null, Util.createRandomAddress(), "hello world")));
        assert receiver.getNumMsgsReceived() == 1;
    }
View Full Code Here

        assert receiver.getNumMsgsReceived() == 1;
    }


    public void testSharedTransport() throws Exception {
        ProtocolStack stack1=new ProtocolStack(), stack2=new ProtocolStack();
        c1.setProtocolStack(stack1);
        c2.setProtocolStack(stack2);

        MyReceiver receiver1=new MyReceiver("A"), receiver2=new MyReceiver("B");

        UDP shared_transport=(UDP)new UDP().setValue("singleton_name", "shared");

        stack1.addProtocol(shared_transport).addProtocols(createProtocols());
        stack2.addProtocol(shared_transport).addProtocols(createProtocols());

        stack1.init();
        stack2.init();

        c1.setReceiver(receiver1);
        c2.setReceiver(receiver2);

        c1.connect("cluster-one");
View Full Code Here

     * Tests sending 1, 2 (OOB) and 3, where they are received in the order 1, 3, 2. Message 3 should not get delivered
     * until message 4 is received (http://jira.jboss.com/jira/browse/JGRP-780)
     */
    public void testRegularAndOOBUnicasts() throws Exception {
        DISCARD discard=new DISCARD();
        ProtocolStack stack=c1.getProtocolStack();
        stack.insertProtocol(discard, ProtocolStack.BELOW, UNICAST.class, UNICAST2.class);

        Address dest=c2.getAddress();
        Message m1=new Message(dest, null, 1);
        Message m2=new Message(dest, null, 2);
        m2.setFlag(Message.OOB);
View Full Code Here

        assert list.contains(1) && list.contains(2) && list.contains(3);
    }

    public void testRegularAndOOBUnicasts2() throws Exception {
        DISCARD discard=new DISCARD();
        ProtocolStack stack=c1.getProtocolStack();
        stack.insertProtocol(discard, ProtocolStack.BELOW, UNICAST.class, UNICAST2.class);

        Address dest=c2.getAddress();
        Message m1=new Message(dest, null, 1);
        Message m2=new Message(dest, null, 2);
        m2.setFlag(Message.OOB);
View Full Code Here

        assert list.contains(1) && list.contains(2) && list.contains(3) && list.contains(4);
    }

    public void testRegularAndOOBMulticasts() throws Exception {
        DISCARD discard=new DISCARD();
        ProtocolStack stack=c1.getProtocolStack();
        stack.insertProtocol(discard, ProtocolStack.BELOW, NAKACK.class);
        c1.setOpt(Channel.LOCAL, false);

        Address dest=null; // send to all
        Message m1=new Message(dest, null, 1);
        Message m2=new Message(dest, null, 2);
View Full Code Here

    @SuppressWarnings("unchecked")
    public void testRandomRegularAndOOBMulticasts() throws Exception {
        DISCARD discard=new DISCARD();
        discard.setLocalAddress(c1.getAddress());
        discard.setDownDiscardRate(0.5);
        ProtocolStack stack=c1.getProtocolStack();
        stack.insertProtocol(discard, ProtocolStack.BELOW, NAKACK.class);
        MyReceiver r1=new MyReceiver("C1"), r2=new MyReceiver("C2");
        c1.setReceiver(r1);
        c2.setReceiver(r2);
        final int NUM_MSGS=20;
        final int NUM_THREADS=10;

        send(null, NUM_MSGS, NUM_THREADS, 0.5); // send on random channel (c1 or c2)
       
        Collection<Integer> one=r1.getMsgs(), two=r2.getMsgs();
        for(int i=0; i < 10; i++) {
            if(one.size() == NUM_MSGS && two.size() == NUM_MSGS)
                break;
            log.info("one size " + one.size() + ", two size " + two.size());
            Util.sleep(1000);
            sendStableMessages(c1,c2);
        }
        log.info("one size " + one.size() + ", two size " + two.size());

        stack.removeProtocol("DISCARD");

        for(int i=0; i < 5; i++) {
            if(one.size() == NUM_MSGS && two.size() == NUM_MSGS)
                break;
            sendStableMessages(c1,c2);
View Full Code Here

TOP

Related Classes of org.jgroups.stack.ProtocolStack$ProtocolStackFactory

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.