Package org.jgroups.stack

Examples of org.jgroups.stack.NakReceiverWindow$Listener


    public void start() throws IOException {
        System.out.println("num_msgs=" + num_msgs + "\ndiscard_prob=" + discard_prob);

        sender=new IpAddress("localhost", 5555);
        win=new NakReceiverWindow(sender, this, 1);
        start=System.currentTimeMillis();
        sendMessages(num_msgs);
    }
View Full Code Here


        assertTrue(win.getHighestSeen() == 4);
    }


    public void testAdd() throws Exception {
        NakReceiverWindow win=new NakReceiverWindow(null, 0);
        assertEquals(0, win.getHighestSeen());
        win.add(0, new Message());
        assertEquals(0, win.getHighestSeen());
        win.add(1, new Message());
        assertEquals(1, win.getHighestSeen());
        win.add(2, new Message());
        win.add(3, new Message());
        win.add(4, new Message());
        assertEquals(4, win.getHighestSeen());
        win.add(6, new Message());
        assertEquals(4, win.getHighestSeen());
        win.add(5, new Message());
        assertEquals(6, win.getHighestSeen());
        while(win.remove() != null) ;
        assertEquals(6, win.getHighestSeen());
    }
View Full Code Here

        assertEquals(6, win.getHighestSeen());
    }


    public void test9() throws Exception {
        NakReceiverWindow win=new NakReceiverWindow(null, 1);
        win.add(1, new Message());
        win.add(2, new Message());
        win.add(3, new Message());
        win.add(4, new Message());
        win.add(6, new Message());
        while((win.remove()) != null) ;
        win.stable(6);
        assertNull(win.get(2));

        //System.out.println(win);
        //System.out.println("highest received=" + win.getHighestReceived() +
        //   "\nhighest_seen=" + win.getHighestSeen() +
        //   "\nhighest_delivered=" + win.getHighestDelivered());
        assertTrue(win.getLowestSeen() == 4);
        assertTrue(win.getHighestSeen() == 4);
    }
View Full Code Here

        assertTrue(win.getHighestSeen() == 4);
    }


    public void testHighestSeen() throws Exception {
        NakReceiverWindow win=new NakReceiverWindow(null, 1);
        win.add(1, new Message());
        win.add(2, new Message());
        win.add(3, new Message());
        win.add(4, new Message());
        assertEquals(win.getHighestSeen(), 4);
        win.add(10, new Message());
        assertEquals(win.getHighestSeen(), 4);
        assertEquals(win.getHighestReceived(), 10);
        System.out.println("win: " + win);
        win.add(9, new Message());
        win.add(7, new Message());
        win.add(8, new Message());
        win.add(6, new Message());
        win.add(5, new Message());
        System.out.println("win: " + win);
        while((win.remove()) != null) ;
        assertEquals(win.getHighestSeen(), 10);
    }
View Full Code Here

        assertEquals(win.getHighestSeen(), 10);
    }


    public void testMissingMessages() throws Exception {
        NakReceiverWindow win=new NakReceiverWindow(null, 1);
        win.add(1, new Message());
        win.add(5, new Message());
        assertEquals(1, win.getHighestSeen());
        win.add(6, new Message());
        assertEquals(1, win.getHighestSeen());
        System.out.println("win: " + win);
    }
View Full Code Here

        System.out.println("win: " + win);
    }


    public void testMissingMessages2() throws Exception {
        NakReceiverWindow win=new NakReceiverWindow(null, 1);
        win.add(1, new Message());
        win.add(5, new Message());
        assertEquals(1, win.getHighestSeen());
        win.add(8, new Message());
        assertEquals(1, win.getHighestSeen());
        win.add(9, new Message());
        assertEquals(1, win.getHighestSeen());
        System.out.println("win: " + win);
    }
View Full Code Here

        System.out.println("win: " + win);
    }


    public void testMissingMessages3() throws Exception {
        NakReceiverWindow win=new NakReceiverWindow(null, 1);
        win.add(1, new Message());
        win.add(5, new Message());
        assertEquals(1, win.getHighestSeen());
        win.add(8, new Message());
        assertEquals(1, win.getHighestSeen());
        win.add(9, new Message());
        assertEquals(1, win.getHighestSeen());
        System.out.println("win: " + win);
        win.add(2, new Message());
        assertEquals(2, win.getHighestSeen());
        win.add(3, new Message());
        win.add(4, new Message());
        assertEquals(5, win.getHighestSeen());
        win.add(7, new Message());
        assertEquals(5, win.getHighestSeen());
        win.add(6, new Message());
        assertEquals(9, win.getHighestSeen());
        win.add(10, new Message());
        assertEquals(10, win.getHighestSeen());
        win.add(11, new Message());
        assertEquals(11, win.getHighestSeen());
        System.out.println("win: " + win);
    }
View Full Code Here

        System.out.println("win: " + win);
    }


    public void testMissingMessages4() throws Exception {
        NakReceiverWindow win=new NakReceiverWindow(null, 101);
        win.add(101, new Message());
        win.add(105, new Message());
        assertEquals(101, win.getHighestSeen());
        win.add(108, new Message());
        assertEquals(101, win.getHighestSeen());
        win.add(109, new Message());
        assertEquals(101, win.getHighestSeen());
        System.out.println("win: " + win);
        win.add(102, new Message());
        assertEquals(102, win.getHighestSeen());
        win.add(103, new Message());
        win.add(104, new Message());
        assertEquals(105, win.getHighestSeen());
        win.add(107, new Message());
        assertEquals(105, win.getHighestSeen());
        win.add(106, new Message());
        assertEquals(109, win.getHighestSeen());
        win.add(110, new Message());
        assertEquals(110, win.getHighestSeen());
        win.add(110, new Message());
        assertEquals(110, win.getHighestSeen());
        System.out.println("win: " + win);
    }
View Full Code Here

        System.out.println("win: " + win);
    }


    public void testMissingMessages5() throws Exception {
        NakReceiverWindow win=new NakReceiverWindow(null, 101);
        win.add(101, new Message());
        assertEquals(101, win.getHighestSeen());
        win.add(108, new Message());
        assertEquals(101, win.getHighestSeen());
        win.add(109, new Message());
        assertEquals(101, win.getHighestSeen());
        System.out.println("win: " + win);
        win.add(102, new Message());
        assertEquals(102, win.getHighestSeen());
        win.add(103, new Message());
        win.add(104, new Message());
        assertEquals(104, win.getHighestSeen());
        win.add(107, new Message());
        assertEquals(104, win.getHighestSeen());
        win.add(106, new Message());
        win.add(105, new Message());
        assertEquals(109, win.getHighestSeen());
        win.add(110, new Message());
        assertEquals(110, win.getHighestSeen());
        win.add(110, new Message());
        assertEquals(110, win.getHighestSeen());
        System.out.println("win: " + win);
    }
View Full Code Here

        assertEquals(110, win.getHighestSeen());
        System.out.println("win: " + win);
    }

    public void test10() throws Exception {
        NakReceiverWindow win=new NakReceiverWindow(null, 1);
        win.add(1, new Message());
        win.add(2, new Message());
        win.add(3, new Message());
        win.add(4, new Message());
        while((win.remove()) != null) ;
        assertTrue(win.getLowestSeen() == 1);
        assertTrue(win.getHighestSeen() == 4);
    }
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.