Package org.jgroups.stack

Examples of org.jgroups.stack.NakReceiverWindow$Listener



    @Test(dataProvider="createTimer")
    public void test13(TimeScheduler timer) throws Exception {
        try {
            NakReceiverWindow win=new NakReceiverWindow(sender, cmd, 0, timer);
            win.add(1, new Message());
            win.add(2, new Message());
            win.add(3, new Message());
            win.add(4, new Message());
            check(win, 0, 4, 0);
            win.remove();
            win.remove();
            win.add(5, new Message());
            win.add(6, new Message());
            check(win, 0, 6, 2);
            win.stable(2);
            check(win, 2, 6, 2);
        }
        finally {
            timer.stop();
        }
View Full Code Here



    @Test(dataProvider="createTimer")
    public void testAddOOBAtHead(TimeScheduler timer) throws Exception {
        try {
            NakReceiverWindow win=new NakReceiverWindow(sender, cmd, 0, timer);
            boolean rc;
            rc=win.add(0, oob());
            assert !(rc);
            rc=win.add(1, oob());
            assert rc;
            rc=win.add(1, oob());
            assert !(rc);
        }
        finally {
            timer.stop();
        }
View Full Code Here


    @Test(dataProvider="createTimer")
    public void testAddOOBAtTail(TimeScheduler timer) throws Exception {
        try {
            NakReceiverWindow win=new NakReceiverWindow(sender, cmd, 0, timer);
            boolean rc;
            rc=win.add(1, oob());
            assert rc;
            rc=win.add(2, oob());
            assert rc;
            rc=win.add(2, oob());
            assert !(rc);
        }
        finally {
            timer.stop();
        }
View Full Code Here


    @Test(dataProvider="createTimer")
    public void testAddOOBInTheMiddle(TimeScheduler timer) throws Exception {
        try {
            NakReceiverWindow win=new NakReceiverWindow(sender, cmd, 0, timer);
            boolean rc;
            rc=win.add(3, oob());
            assert rc;
            rc=win.add(3, oob());
            assert !(rc);
            rc=win.add(1, oob());
            assert rc;
            rc=win.add(1, oob());
            assert !(rc);
            rc=win.add(2, oob());
            assert rc;
            rc=win.add(2, oob());
            assert !(rc);
        }
        finally {
            timer.stop();
        }
View Full Code Here


    @Test(dataProvider="createTimer")
    public void testRemoveRegularAndOOBMessages(TimeScheduler timer) {
        try {
            NakReceiverWindow win=new NakReceiverWindow(sender, cmd, 0, timer);
            win.add(1, msg());
            System.out.println("win = " + win);
            win.remove();
            System.out.println("win = " + win);
            assert win.getHighestDelivered() == 1;

            win.add(3, msg());
            win.remove();
            System.out.println("win = " + win);
            assert win.getHighestDelivered() == 1;

            win.add(2, oob());
            System.out.println("win = " + win);

            assert win.getHighestDelivered() == 1 : "highest_delivered should be 2, but is " + win.getHighestDelivered();
        }
        finally {
            timer.stop();
        }
    }
View Full Code Here


    @Test(dataProvider="createTimer")
    public void testRemoveMany(TimeScheduler timer) {
        try {
            NakReceiverWindow win=new NakReceiverWindow(sender, cmd, 0, timer);
            win.add(1, msg());
            win.add(2, msg());
            win.add(3, msg());
            win.add(5, msg());
            win.add(6, msg());
            System.out.println("win = " + win);
            List<Message> msgs=win.removeMany(null);
            System.out.println("msgs = " + msgs);
            assert msgs.size() == 3;

            win.add(4, msg());
            msgs=win.removeMany(null);
            System.out.println("msgs = " + msgs);
            assert msgs.size() == 3;
        }
        finally {
            timer.stop();
View Full Code Here

    }

    @Test(dataProvider="createTimer")
    public void testRemoveMany2(TimeScheduler timer) {
        try {
            NakReceiverWindow win=new NakReceiverWindow(sender, cmd, 4, timer);
            win.add(5, msg());
            win.add(6, msg());
            win.add(7, msg());
            win.add(9, msg());
            win.add(10, msg());
            System.out.println("win = " + win);
            List<Message> msgs=win.removeMany(null);
            System.out.println("msgs = " + msgs);
            assert msgs.size() == 3;

            win.add(8, msg());
            msgs=win.removeMany(null);
            System.out.println("msgs = " + msgs);
            assert msgs.size() == 3;
        }
        finally {
            timer.stop();
View Full Code Here


    @Test(dataProvider="createTimer")
    public void testRetransmitter(TimeScheduler timer) {
        try {
            NakReceiverWindow win=new NakReceiverWindow(sender, cmd, 0, timer);
            win.add(1, msg());
            win.add(2, msg());
            win.add(3, msg());
            win.add(5, msg());
            win.add(6, msg());
            System.out.println("win = " + win);
            int num_pending_xmits=win.getPendingXmits();
            assert num_pending_xmits == 1;

            win.add(4, msg());
            num_pending_xmits=win.getPendingXmits();
            assert num_pending_xmits == 0;
        }
        finally {
            timer.stop();
        }
View Full Code Here

    private static void add(int num_msgs, TimeScheduler timer) {
        try {
            long start, stop;
            double time_per_msg;
            NakReceiverWindow win=new NakReceiverWindow(sender, cmd, 1, timer);
            start=System.currentTimeMillis();
            for(int i=1; i < 1 + num_msgs; i++) {
                win.add(i, new Message());
            }
            stop=System.currentTimeMillis();
            time_per_msg=(stop-start) / (double)num_msgs;
            System.out.println("-- time for " + num_msgs + " msgs: " + (stop-start) + ", " + time_per_msg + " ms/msg");
        }
View Full Code Here

    NakReceiverWindow win;

    @BeforeMethod
    void init() {
        win=new NakReceiverWindow(self, new Retransmitter.RetransmitCommand() {
            public void retransmit(long first_seqno, long last_seqno, Address sender) {
            }
        }, 0, 0, new DefaultTimeScheduler(2));
    }
View Full Code Here

TOP

Related Classes of org.jgroups.stack.NakReceiverWindow$Listener

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.