Package org.simpleframework.util.thread

Examples of org.simpleframework.util.thread.Scheduler.execute()


   public void testScheduler() throws Exception {
      Scheduler queue = new Scheduler(10);
      LinkedBlockingQueue<Timer> list = new LinkedBlockingQueue<Timer>();
     
      for(int i = 0; i < ITERATIONS; i++) {
         queue.execute(new Task(list, new Timer(i)), i, TimeUnit.MILLISECONDS);
      }     
      for(Timer timer = list.take(); timer.getValue() < ITERATIONS - 10; timer = list.take()) {
         System.err.println("value=["+timer.getValue()+"] delay=["+timer.getDelay()+"] expect=["+timer.getExpectation()+"]");
      }     
   }
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.