Package org.jboss.util.threadpool

Examples of org.jboss.util.threadpool.BasicThreadPool.run()


      BasicThreadPool pool = new BasicThreadPool();
      pool.setMaximumQueueSize(1);
      pool.setMaximumPoolSize(1);
      try
      {
         pool.run(new TestRunnable(HOLD_START, "test1"));
         waitStarted(1);
         pool.run(new TestRunnable(BASIC, "test2"));

         boolean caught = false;
         try
View Full Code Here


      pool.setMaximumPoolSize(1);
      try
      {
         pool.run(new TestRunnable(HOLD_START, "test1"));
         waitStarted(1);
         pool.run(new TestRunnable(BASIC, "test2"));

         boolean caught = false;
         try
         {
            pool.run(new TestRunnable(BASIC, "test3"));
View Full Code Here

         pool.run(new TestRunnable(BASIC, "test2"));

         boolean caught = false;
         try
         {
            pool.run(new TestRunnable(BASIC, "test3"));
         }
         catch (ThreadPoolFullException expected)
         {
            caught = true;
         }
View Full Code Here

      pool.setMaximumQueueSize(1);
      pool.setMaximumPoolSize(1);
      try
      {
         TestRunnable test = new TestRunnable(HOLD_START, "test1", 12*1000);
         pool.run(test, 0, 10*1000);
         waitStarted(1);
         releaseStarted("test1");
         waitFinished(1);
         assertEquals(makeExpected(new Object[] {"test1"}), finishedRunnables);
      }
View Full Code Here

      pool.setMaximumQueueSize(1);
      pool.setMaximumPoolSize(1);
      try
      {
         TestRunnable test = new TestRunnable(HOLD_START, "test1", Long.MAX_VALUE);
         pool.run(test, 0, 8*1000);
         waitStarted(1);
         releaseStarted("test1");
         Thread.sleep(12*1000);
         // Run another task to validate the previous thread has been cleared
         pool.run(new TestRunnable(BASIC, "test2"));
View Full Code Here

         pool.run(test, 0, 8*1000);
         waitStarted(1);
         releaseStarted("test1");
         Thread.sleep(12*1000);
         // Run another task to validate the previous thread has been cleared
         pool.run(new TestRunnable(BASIC, "test2"));
         waitStarted(1);
         releaseStarted("test2");
         waitFinished(1);
         assertEquals(makeExpected(new Object[] {"test2"}), finishedRunnables);
      }
View Full Code Here

      pool.setMaximumPoolSize(1);
      pool.setBlockingMode(BlockingMode.RUN);
      try
      {
         TestRunnable test = new TestRunnable(BASIC, "testx", Long.MAX_VALUE);
         pool.run(test, 0, 1*1000);
         // Run another task to validate the previous thread has been cleared
         ArrayList tmp = new ArrayList();
         for(int n = 0; n < 10; n ++)
         {
            String name = "test"+n;
View Full Code Here

         // Run another task to validate the previous thread has been cleared
         ArrayList tmp = new ArrayList();
         for(int n = 0; n < 10; n ++)
         {
            String name = "test"+n;
            pool.run(new TestRunnable(BASIC, name));
            tmp.add(name);
         }
         Thread.sleep(3000);
         assertEquals(makeExpected(tmp.toArray()), finishedRunnables);
      }
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.