Package org.jgroups.protocols.pbcast

Examples of org.jgroups.protocols.pbcast.NAKACK$Entry


    @BeforeMethod
    protected void setUp() throws Exception {
        a=Util.createRandomAddress("A");
        b=Util.createRandomAddress("B");
        c=Util.createRandomAddress("C");
        nak=new NAKACK();
        d1=new MutableDigest(2);
        d1.add(a, 0, 11, 11);
        d1.add(b, 0, 30, 35);

        d2=new MutableDigest(3);
View Full Code Here


          .addProtocol(new PING())
          .addProtocol(new MERGE2())
          .addProtocol(new FD_SOCK())
          .addProtocol(new VERIFY_SUSPECT())
          .addProtocol(new BARRIER())
          .addProtocol(new NAKACK().setValue("use_mcast_xmit", false).setValue("discard_delivered_msgs", true))
          .addProtocol(new UNICAST2().setValue("stable_interval", 10000).setValue("max_bytes", 50000))
          .addProtocol(new STABLE().setValue("max_bytes", 50000))
          .addProtocol(new GMS().setValue("print_local_addr", false))
          .addProtocol(new UFC().setValue("max_credits", 2000000))
          .addProtocol(new MFC().setValue("max_credits", 2000000))
View Full Code Here

                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

        MERGE2 merge=(MERGE2)stack.findProtocol("MERGE2");
        if(merge != null) {
            merge.setMinInterval(2000);
            merge.setMaxInterval(5000);
        }
        NAKACK nakack=(NAKACK)stack.findProtocol(NAKACK.class);
        if(nakack != null)
            nakack.setLogDiscardMsgs(false);
    }
View Full Code Here

    @BeforeMethod
    protected void setUp() throws Exception {
        c1=Util.createRandomAddress("C1");
        c2=Util.createRandomAddress("C2");
        nak=new NAKACK();

        TP transport=new TP() {
            public boolean supportsMulticasting() {return false;}
            public void sendMulticast(byte[] data, int offset, int length) throws Exception {}
            public void sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length) throws Exception {}
View Full Code Here

    public static void stressTestOOB(TimeScheduler timer) {
        start(NUM_THREADS, NUM_MSGS, true, timer);
    }

    private static void start(final int num_threads, final int num_msgs, boolean oob, TimeScheduler timer) {
        final NAKACK nak=new NAKACK();
        final AtomicInteger counter=new AtomicInteger(num_msgs);
        final AtomicLong seqno=new AtomicLong(1);
        final AtomicInteger delivered_msgs=new AtomicInteger(0);
        final Lock lock=new ReentrantLock();
        final Condition all_msgs_delivered=lock.newCondition();
        final ConcurrentLinkedQueue<Long> delivered_msg_list=new ConcurrentLinkedQueue<Long>();
        final Address local_addr=Util.createRandomAddress("A");
        final Address sender=Util.createRandomAddress("B");


        if(timer == null)
            timer=new TimeScheduler2();
        nak.setTimer(timer);
        System.out.println("timer is a " + timer.getClass());

        nak.setDownProtocol(new Protocol() {public Object down(Event evt) {return null;}});

        nak.setUpProtocol(new Protocol() {
            public Object up(Event evt) {
                if(evt.getType() == Event.MSG) {
                    delivered_msgs.incrementAndGet();
                    NakAckHeader hdr=(NakAckHeader)((Message)evt.getArg()).getHeader(NAKACK_ID);
                    if(hdr != null)
                        delivered_msg_list.add(hdr.getSeqno());

                    if(delivered_msgs.get() >= num_msgs) {
                        lock.lock();
                        try {
                            all_msgs_delivered.signalAll();
                        }
                        finally {
                            lock.unlock();
                        }
                    }
                }
                return null;
            }
        });

        nak.setDiscardDeliveredMsgs(true);
        nak.down(new Event(Event.SET_LOCAL_ADDRESS, local_addr));
        nak.down(new Event(Event.BECOME_SERVER));
        View view=new View(local_addr, 1, Arrays.asList(local_addr, sender));
        nak.down(new Event(Event.VIEW_CHANGE, view));

        MutableDigest digest=new MutableDigest();
        digest.add(local_addr, 0, 0, 0);
        digest.add(sender, 0, 0, 0);
        nak.down(new Event(Event.SET_DIGEST, digest));

        final CountDownLatch latch=new CountDownLatch(1);
        Sender[] adders=new Sender[num_threads];
        for(int i=0; i < adders.length; i++) {
            adders[i]=new Sender(nak, latch, counter, seqno, oob, sender);
            adders[i].start();
        }

        long start=System.currentTimeMillis();
        latch.countDown(); // starts all adders

        lock.lock();
        try {
            while(delivered_msgs.get() < num_msgs) {
                try {
                    all_msgs_delivered.await(1000, TimeUnit.MILLISECONDS);
                    System.out.println("received " + delivered_msgs.get() + " msgs");
                }
                catch(InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
        finally {
            lock.unlock();
        }

        long time=System.currentTimeMillis() - start;
        double requests_sec=num_msgs / (time / 1000.0);
        System.out.println("\nTime: " + time + " ms, " + Util.format(requests_sec) + " requests / sec\n");
        System.out.println("Delivered messages: " + delivered_msg_list.size());
        if(delivered_msg_list.size() < 100)
            System.out.println("Elements: " + delivered_msg_list);

        nak.stop();
        timer.stop();

        List<Long> results=new ArrayList<Long>(delivered_msg_list);

        if(oob)
View Full Code Here

                new MERGE2(),
                new FD_SOCK(),
                new FD_ALL().setValue("timeout", 12000).setValue("interval", 3000),
                new VERIFY_SUSPECT(),
                new BARRIER(),
                new NAKACK(),
                new UNICAST2(),
                new STABLE(),
                new GMS(),
                new UFC(),
                new MFC(),
View Full Code Here

            simulators[i]=new Simulator();
            simulators[i].setLocalAddress(addresses[i]);
            simulators[i].setView(view);

            // set up the protocol under test
            layers[i]=new NAKACK();

            // set up its properties
            layers[i].setUseMcastXmit(true);

            // our protocol stack under test consists of one protocol
View Full Code Here

        .addProtocol(new PING())
        .addProtocol(new MERGE2())
        .addProtocol(new FD_SOCK())
        .addProtocol(new FD_ALL().setValue("timeout", 12000).setValue("interval", 3000))
        .addProtocol(new VERIFY_SUSPECT()).addProtocol(new BARRIER())
        .addProtocol(new NAKACK()).addProtocol(new UNICAST2())
        .addProtocol(new STABLE()).addProtocol(new GMS())
        .addProtocol(new UFC()).addProtocol(new MFC())
        .addProtocol(new FRAG2());
    stack.init();
   
View Full Code Here

        .addProtocol(new PING())
        .addProtocol(new MERGE2())
        .addProtocol(new FD_SOCK())
        .addProtocol(new FD_ALL().setValue("timeout", 12000).setValue("interval", 3000))
        .addProtocol(new VERIFY_SUSPECT()).addProtocol(new BARRIER())
        .addProtocol(new NAKACK()).addProtocol(new UNICAST2())
        .addProtocol(new STABLE()).addProtocol(new GMS())
        .addProtocol(new UFC()).addProtocol(new MFC())
        .addProtocol(new FRAG2());
    stack.init();
   
View Full Code Here

TOP

Related Classes of org.jgroups.protocols.pbcast.NAKACK$Entry

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.