Package org.jboss.util.timeout

Examples of org.jboss.util.timeout.TimeoutFactory


   private void createFactory()
   {
      BasicThreadPool threadPool = new BasicThreadPool("Messaging Timeout");
      threadPool.setMaximumQueueSize(Integer.MAX_VALUE);
      factory = new TimeoutFactory(threadPool);
   }
View Full Code Here


   }
   public void testDefaultCtr() throws Exception
   {
      final int times = 5000;
      TT tt = new TT();
      TimeoutFactory tf = new TimeoutFactory();
      for (int i = 0; i < times; i++)
      {
         tf.schedule(0, (Runnable)tt);
      }
      count.whenEqual(times, null);
      assertEquals(times, count.get());
   }
View Full Code Here

   public void testConsecutiveTimeouts() throws Exception
   {
      final int times = 1000;     
      TT tt = new TT();
      TimeoutFactory tf = new TimeoutFactory();
      long now = System.currentTimeMillis();
      for (int i = 0; i < 10; i++)
      {
         for (int j = 0; j < 100; j++)
         {
            tf.schedule(now + i*50, (TimeoutTarget)tt);
         }
      }
      count.whenEqual(times, null);
      assertEquals(times, count.get());     
   }
View Full Code Here

  
   public void testCancel() throws Exception
   {
      final int times = 100;
      TT tt = new TT();
      TimeoutFactory tf = new TimeoutFactory();
      long at = System.currentTimeMillis() + 300;
      for (int i = 0; i < times; i++)
      {
         Timeout t = tf.schedule(at, (TimeoutTarget)tt);
         t.cancel();
      }
      Thread.sleep(500);
      assertEquals(0, count.get());
   }
View Full Code Here

   public void testCancelFactory() throws Exception
   {
      final int times = 100;
      TT tt = new TT();
      TimeoutFactory tf = new TimeoutFactory();
      long at = System.currentTimeMillis() + 300;
      for (int i = 0; i < times; i++)
      {
         tf.schedule(at, (TimeoutTarget)tt);
      }
      tf.cancel();
      Thread.sleep(500);
      assertEquals(0, count.get());
   }
View Full Code Here

      BasicThreadPool tp = new BasicThreadPool();
      tp.setMaximumQueueSize(1);
      tp.setMaximumPoolSize(1);
      tp.setBlockingMode(BlockingMode.RUN);
      TT tt = new TT();
      TimeoutFactory tf = new TimeoutFactory(tp);
      for (int i = 0; i < times; i++)
      {
         tf.schedule(0, (TimeoutTarget)tt);
      }
      count.whenEqual(times, null);
      assertEquals(times, count.get());
   }
View Full Code Here

      final int times = 50;
      BasicThreadPool tp = new BasicThreadPool();
      tp.setMaximumQueueSize(1);
      tp.setMaximumPoolSize(1);
      TT tt = new TT();
      TimeoutFactory tf = new TimeoutFactory(tp);
      for (int i = 0; i < times; i++)
      {
         tf.schedule(0, (TimeoutTarget)tt);
      }
      Thread.sleep(500);
      getLog().debug("Executed: " + count.get() + ", scheduled: " + times);
      assertTrue("Executed " + count.get() + " < scheduled " + times, count.get() < times);
   }
View Full Code Here

   }
  
   public void testFailedTarget() throws Exception
   {
      final int times = 50;
      TimeoutFactory tf = new TimeoutFactory();          
      TT tt = new TT();
      tt.fail = true;
      for (int i = 0; i < times; i++)
      {
         tf.schedule(0, (TimeoutTarget)tt);
      }
      Thread.sleep(500);
      assertEquals(count.get(), 0);
   }
View Full Code Here

/*    */   }
/*    */
/*    */   private void createFactory()
/*    */   {
/* 75 */     ThreadPool threadPool = new BasicThreadPool("Messaging Timeout");
/* 76 */     this.factory = new TimeoutFactory(threadPool);
/*    */   }
View Full Code Here

/*     */ {
/*     */   private TimeoutFactory factory;
/*     */
/*     */   public RunnableScheduler()
/*     */   {
/*  58 */     this.factory = new TimeoutFactory();
/*     */   }
View Full Code Here

TOP

Related Classes of org.jboss.util.timeout.TimeoutFactory

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.