Examples of AckCollector


Examples of org.jgroups.util.AckCollector

        protected final long         timestamp; // creation time (ns)

        /** Unicast entry */
        protected Entry(Address member) {
            this.target=member;
            this.ack_collector=new AckCollector(member);
            this.timestamp=System.nanoTime();
        }
View Full Code Here

Examples of org.jgroups.util.AckCollector

        }

        /** Multicast entry */
        protected Entry(Collection<Address> members) {
            this.target=null;
            this.ack_collector=new AckCollector(members);
            this.timestamp=System.nanoTime();
        }
View Full Code Here

Examples of org.jgroups.util.AckCollector

      five=Util.createRandomAddress("five");
    final List<Address> list=Arrays.asList(one, two, three, four, five);


    public void testConstructor() {
        AckCollector ac=new AckCollector(list);
        System.out.println("AckCollector is " + ac);
        Assert.assertEquals(5,ac.size());
    }
View Full Code Here

Examples of org.jgroups.util.AckCollector

        Assert.assertEquals(5,ac.size());
    }


    public void testWaitForAllAcksNoTimeout() {
        final AckCollector ac=new AckCollector(list);
        new Thread() {
            public void run() {
                for(Address member: list) {
                    Util.sleep(100);
                    ac.ack(member);
                    System.out.println("AckCollector: " + ac);
                }
            }
        }.start();
        ac.waitForAllAcks();
        Assert.assertEquals(0, ac.size());
    }
View Full Code Here

Examples of org.jgroups.util.AckCollector

        Assert.assertEquals(0, ac.size());
    }

    @Test(expectedExceptions=TimeoutException.class)
    public void testWaitForAllAcksWithTimeoutException() throws TimeoutException {
        AckCollector ac=new AckCollector(list);
        ac.waitForAllAcks(200);
    }
View Full Code Here

Examples of org.jgroups.util.AckCollector

        AckCollector ac=new AckCollector(list);
        ac.waitForAllAcks(200);
    }

    public void testWaitForAllAcksWithTimeout() {
        final AckCollector ac=new AckCollector(list);
        new Thread() {
            public void run() {
                for(Address member: list) {
                    Util.sleep(100);
                    ac.ack(member);
                    System.out.println("AckCollector: " + ac);
                }
            }
        }.start();
        try {
            ac.waitForAllAcks(30000);
            assert true : "we should not get a timeout exception here";
        }
        catch(TimeoutException e) {
            assert false : "we should not get a timeout exception here";
        }
        Assert.assertEquals(0, ac.size());
    }
View Full Code Here

Examples of org.jgroups.util.AckCollector

    }


    @Test(expectedExceptions=TimeoutException.class)
    public void testWaitForAllAcksWithTimeoutException2() throws TimeoutException {
        final AckCollector ac=new AckCollector(list);
        new Thread() {
            public void run() {
                for(Address member: list) {
                    Util.sleep(100);
                    ac.ack(member);
                    System.out.println("AckCollector: " + ac);
                }
            }
        }.start();
        ac.waitForAllAcks(10);
    }
View Full Code Here

Examples of org.jgroups.util.AckCollector

        ac.waitForAllAcks(10);
    }

    @Test(expectedExceptions=TimeoutException.class)
    public void testReset() throws TimeoutException {
        final AckCollector ac=new AckCollector(list);
        final Address six=Util.createRandomAddress("six"), seven=Util.createRandomAddress("seven"),
          eight=Util.createRandomAddress("eight");
        final List<Address> new_list=Arrays.asList(six, seven, eight);
        new Thread() {
            public void run() {
                Util.sleep(500);
                System.out.println("resetting AckCollector");
                ac.reset(new_list);
                System.out.println("reset AckCollector: " + ac);
            }
        }.start();
        System.out.println("initial AckCollector: " + ac);
        ac.waitForAllAcks(1000);
        System.out.println("new AckCollector: " + ac);
    }
View Full Code Here

Examples of org.jgroups.util.AckCollector

        System.out.println("new AckCollector: " + ac);
    }


    public void testReset2() throws TimeoutException {
        final AckCollector ac=new AckCollector(list);
        final Address six=Util.createRandomAddress("six"), seven=Util.createRandomAddress("seven"),
          eight=Util.createRandomAddress("eight");
        final List<Address> new_list=Arrays.asList(six, seven, eight);

        new Thread() {
            public void run() {
                Util.sleep(500);
                System.out.println("resetting AckCollector");
                ac.reset(new_list);
                System.out.println("reset AckCollector: " + ac);
                Util.sleep(100);
                ac.ack(six);
                System.out.println("AckCollector: " + ac);
                Util.sleep(100);
                ac.ack(seven);
                System.out.println("AckCollector: " + ac);
                Util.sleep(100);
                ac.ack(eight);
                System.out.println("AckCollector: " + ac);
            }
        }.start();
        System.out.println("initial AckCollector: " + ac);
        ac.waitForAllAcks(30000);
        System.out.println("new AckCollector: " + ac);
    }
View Full Code Here

Examples of org.jgroups.util.AckCollector

        System.out.println("new AckCollector: " + ac);
    }

    public void testResetWithDuplicateMembers() {
        List<Address> tmp_list=Arrays.asList(one,two,one,three,four,one,five);
        AckCollector ac=new AckCollector(tmp_list);
        System.out.println("ac = " + ac);
        assert ac.size() == 5;
        ac.reset(tmp_list);
        assert ac.size() == 5;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.