Package org.teiid.dqp.internal.process

Examples of org.teiid.dqp.internal.process.ThreadReuseExecutor.execute()


        final int MAX_THREADS = 5;

        final ThreadReuseExecutor pool = new ThreadReuseExecutor("test", MAX_THREADS); //$NON-NLS-1$
       
        for(int i=0; i<WORK_ITEMS; i++) {
            pool.execute(new FakeWorkItem(SINGLE_WAIT));
        }
       
        pool.shutdown();       
        pool.awaitTermination(1000, TimeUnit.MILLISECONDS);
        assertTrue(pool.isTerminated());
View Full Code Here


        final long NUM_THREADS = 5;

        ThreadReuseExecutor pool = new ThreadReuseExecutor("test", 5); //$NON-NLS-1$
       
        for(int i=0; i<NUM_THREADS; i++) {           
          pool.execute(new FakeWorkItem(SINGLE_WAIT));
           
            try {
                Thread.sleep(SINGLE_WAIT*3);
            } catch(InterruptedException e) {               
            }
View Full Code Here

    }
   
    @Test(expected=RejectedExecutionException.class) public void testShutdown() throws Exception {
      ThreadReuseExecutor pool = new ThreadReuseExecutor("test", 5); //$NON-NLS-1$
        pool.shutdown();
      pool.execute(new FakeWorkItem(1));
    }
   
    @Test public void testScheduleCancel() throws Exception {
      ThreadReuseExecutor pool = new ThreadReuseExecutor("test", 5); //$NON-NLS-1$
      ScheduledFuture<?> future = pool.scheduleAtFixedRate(new Runnable() {
View Full Code Here

    }
   
    @Test public void testFailingWork() throws Exception {
      ThreadReuseExecutor pool = new ThreadReuseExecutor("test", 5); //$NON-NLS-1$
      final AtomicInteger count = new AtomicInteger();
      pool.execute(new Work() {
        @Override
        public void run() {
          count.getAndIncrement();
          throw new RuntimeException();
        }
View Full Code Here

        public Boolean call() throws Exception {
          order.add(4);
          return false;
        }
    }, 2);
      pool.execute(work1);
      pool.execute(work2);
      pool.execute(work3);
      pool.execute(work4);
      synchronized (pool) {
          pool.notifyAll();
View Full Code Here

          order.add(4);
          return false;
        }
    }, 2);
      pool.execute(work1);
      pool.execute(work2);
      pool.execute(work3);
      pool.execute(work4);
      synchronized (pool) {
          pool.notifyAll();
    }
View Full Code Here

          return false;
        }
    }, 2);
      pool.execute(work1);
      pool.execute(work2);
      pool.execute(work3);
      pool.execute(work4);
      synchronized (pool) {
          pool.notifyAll();
    }
      work1.get();
View Full Code Here

        }
    }, 2);
      pool.execute(work1);
      pool.execute(work2);
      pool.execute(work3);
      pool.execute(work4);
      synchronized (pool) {
          pool.notifyAll();
    }
      work1.get();
      work2.get();
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.