Package org.jgroups.util

Examples of org.jgroups.util.RetransmitTable


        assert list.isEmpty() : " list: " + Util.print(list);
    }


    public void testResizeWithPurge2() {
        RetransmitTable table=new RetransmitTable(3, 10, 0);
        for(long i=0; i < 50; i++)
            addAndGet(table, i, "hello-" + i);
        System.out.println("table = " + table);
        assert table.size() == 50;
        assert table.capacity() == 50;
        assert table.getHighestPurged() == 0;
        assert table.getHighest() == 49;

        table.purge(43);
        addAndGet(table, 52, "hello-52");
        assert table.get(43) == null;

        for(long i=44; i < 50; i++) {
            Message msg=table.get(i);
            assert msg != null && msg.getObject().equals("hello-" + i);
        }

        assert table.get(50) == null;
        assert table.get(51) == null;
        Message msg=table.get(52);
        assert msg != null && msg.getObject().equals("hello-52");
        assert table.get(53) == null;
    }
View Full Code Here


        assert table.get(53) == null;
    }


    public static void testMove() {
        RetransmitTable table=new RetransmitTable(3, 10, 0);
        for(long i=0; i < 50; i++)
            addAndGet(table, i, "hello-" + i);
        table.purge(49);
        assert table.isEmpty();
        addAndGet(table, 50, "50");
        assert table.size() == 1;
        assert table.capacity() == 50;
    }
View Full Code Here

        assert table.capacity() == 50;
    }


    public static void testPurge() {
        RetransmitTable table=new RetransmitTable(5, 10, 0);
        for(long seqno=0; seqno < 25; seqno++)
            table.put(seqno, MSG);

        long[] seqnos={30,31,32,37,38,39, 40,41,42,47,48,49};
        for(long seqno: seqnos)
            table.put(seqno, MSG);

        System.out.println("table (before remove):\n" + table.dump());
        for(long seqno=0; seqno <= 22; seqno++)
            table.remove(seqno);

        System.out.println("\ntable (after remove 22, before purge):\n" + table.dump());
        table.purge(22);
        System.out.println("\ntable: (after purge 22):\n" + table.dump());
        assert table.size() == 2 + seqnos.length;
    }
View Full Code Here

        assert table.size() == 2 + seqnos.length;
    }


    public void testCompact() {
        RetransmitTable table=new RetransmitTable(3, 10, 0);
        for(long i=0; i < 80; i++)
            addAndGet(table, i, "hello-" + i);
        assert table.size() == 80;
        table.purge(59);
        assert table.size() == 20;
        table.compact();
        assert table.size() == 20;
        assert table.capacity() == 40;
    }
View Full Code Here

        assert table.capacity() == 40;
    }


    public void testCompactWithAutomaticPurging() {
        RetransmitTable table=new RetransmitTable(3, 10, 0);
        table.setAutomaticPurging(true);
        for(long i=0; i < 80; i++)
             addAndGet(table, i, "hello-" + i);
        assert table.size() == 80;
        for(long i=0; i <= 59; i++)
            table.remove(i);

        assert table.size() == 20;
        table.compact();
        assert table.size() == 20;
        assert table.capacity() == 40;
    }
View Full Code Here

            retransmitter=use_range_based_retransmitter?
              new RangeBasedRetransmitter(sender, cmd, sched) :
              new DefaultRetransmitter(sender, cmd, sched);
        }

        xmit_table=new RetransmitTable(num_rows, msgs_per_row, highest_delivered, resize_factor, max_compaction_time, automatic_purging);
    }
View Full Code Here

        if(cmd != null)
            retransmitter=use_range_based_retransmitter?
                    new RangeBasedRetransmitter(sender, cmd, sched) :
                    new DefaultRetransmitter(sender, cmd, sched);

        xmit_table=new RetransmitTable(num_rows, msgs_per_row, low, resize_factor, max_compaction_time, automatic_purging);
    }
View Full Code Here

@Test(groups=Global.FUNCTIONAL,sequential=false)
public class RetransmitTableTest {
    static final Message MSG=new Message(null, null, "test");

    public static void testCreation() {
        RetransmitTable table=new RetransmitTable(3, 10, 0);
        int size=table.size();
        assert size == 0;
        assert table.get(15) == null;
    }
View Full Code Here

        assert table.get(15) == null;
    }


    public static void testAddition() {
        RetransmitTable table=new RetransmitTable(3, 10, 0);
        addAndGet(table,  0"0");
        addAndGet(table,  1"1");
        addAndGet(table,  5"5");
        addAndGet(table,  9"9");
        addAndGet(table, 10, "10");
        addAndGet(table, 11, "11");
        addAndGet(table, 19, "19");
        addAndGet(table, 20, "20");
        addAndGet(table, 29, "29");
        System.out.println("table: " + table.dump());
        assert table.size() == 9;
        assert table.size() == table.computeSize();
        assertCapacity(table.capacity(), 3, 10);
    }
View Full Code Here

        assertCapacity(table.capacity(), 3, 10);
    }


    public static void testAdditionWithOffset() {
        RetransmitTable table=new RetransmitTable(3, 10, 100);
        addAndGet(table, 100, "100");
        addAndGet(table, 101, "101");
        addAndGet(table, 105, "105");
        addAndGet(table, 109, "109");
        addAndGet(table, 110, "110");
        addAndGet(table, 111, "111");
        addAndGet(table, 119, "119");
        addAndGet(table, 120, "120");
        addAndGet(table, 129, "129");
        System.out.println("table: " + table.dump());
        assert table.size() == 9;
        assertCapacity(table.capacity(), 3, 10);
    }
View Full Code Here

TOP

Related Classes of org.jgroups.util.RetransmitTable

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.