Package org.jgroups.util

Examples of org.jgroups.util.TimeScheduler3


@Test(groups=Global.FUNCTIONAL,singleThreaded=true)
public class TimeServiceTest {
    protected TimeScheduler timer;
    protected TimeService   time_service;

    @BeforeClass  public void init()    {timer=new TimeScheduler3();}
View Full Code Here


                NUM_THREADS=Integer.parseInt(args[++i]);
            }
        }

        Address sender=Util.createRandomAddress("A");
        TimeScheduler timer=new TimeScheduler3();

        NakReceiverWindow win=new NakReceiverWindow(sender, new Retransmitter.RetransmitCommand() {

            public void retransmit(long first_seqno, long last_seqno, Address sender) {
                System.out.println("-- retransmit(" + first_seqno + "-" + last_seqno);
            }
        }, 0, timer, true);

        // win.setRetransmitTimeouts(new ExponentialInterval(1000));

        final CountDownLatch latch=new CountDownLatch(1);

        Remover remover=new Remover(win, latch);
        remover.start();

        Adder[] adders=new Adder[NUM_THREADS];
        for(int i=0; i < adders.length; i++) {
            adders[i]=new Adder(win, latch, added);
            adders[i].start();
        }

        Util.sleep(1000);

        long start=System.currentTimeMillis();
        latch.countDown();
        while(remover.isAlive()) {
            System.out.println("added messages: " + added + ", removed messages: " + removed);
            remover.join(2000);
        }
        long diff=System.currentTimeMillis() - start;

        System.out.println("added messages: " + added + ", removed messages: " + removed);
        System.out.println("took " + diff + " ms to insert and remove " + NUM_MSGS + " messages");
        win.destroy();
        timer.stop();
    }
View Full Code Here

TOP

Related Classes of org.jgroups.util.TimeScheduler3

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.