Examples of awaitTermination()


Examples of org.jberet.runtime.JobExecutionImpl.awaitTermination()

        final JobOperator jobOperator = BatchRuntime.getJobOperator();
        final long jobExecutionId;
        try {
            jobExecutionId = jobOperator.start(jobXml, jobParameters);
            final JobExecutionImpl jobExecution = (JobExecutionImpl) jobOperator.getJobExecution(jobExecutionId);
            jobExecution.awaitTermination(0, TimeUnit.SECONDS)//no timeout

            if (!jobExecution.getBatchStatus().equals(BatchStatus.COMPLETED)) {
                throw new BatchRuntimeException(String.format("The job did not complete: %s%n", jobXml));
            }
        } catch (InterruptedException e) {
View Full Code Here

Examples of org.jboss.dna.graph.connector.RepositoryConnectionPool.awaitTermination()

            this.sourcesLock.writeLock().lock();
            RepositoryConnectionPool existingPool = this.pools.remove(name);
            if (existingPool != null) {
                // Then shut down the source gracefully (and don't wait) ...
                existingPool.shutdown();
                if (timeToAwait > 0L) existingPool.awaitTermination(timeToAwait, unit);
                return existingPool.getRepositorySource();
            }
        } finally {
            this.sourcesLock.writeLock().unlock();
        }
View Full Code Here

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

        for(int i=0; i<WORK_ITEMS; i++) {
            pool.execute(new FakeWorkItem(SINGLE_WAIT));
        }
       
        pool.shutdown();       
        pool.awaitTermination(1000, TimeUnit.MILLISECONDS);
        assertTrue(pool.isTerminated());
        WorkerPoolStatisticsMetadata stats = pool.getStats();
        assertEquals(10, stats.getTotalCompleted());
        assertEquals("Expected threads to be maxed out", MAX_THREADS, stats.getHighestActiveThreads()); //$NON-NLS-1$
    }
View Full Code Here

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

        pool.shutdown();               
       
        WorkerPoolStatisticsMetadata stats = pool.getStats();
        assertEquals("Expected 1 thread for serial execution", 1, stats.getHighestActiveThreads()); //$NON-NLS-1$
       
        pool.awaitTermination(1000, TimeUnit.MILLISECONDS);
    }
   
    @Test(expected=RejectedExecutionException.class) public void testShutdown() throws Exception {
      ThreadReuseExecutor pool = new ThreadReuseExecutor("test", 5); //$NON-NLS-1$
        pool.shutdown();
View Full Code Here

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

       
      }
    }, 5, TimeUnit.MILLISECONDS);
      Thread.sleep(100);
      pool.shutdown();
      pool.awaitTermination(1000, TimeUnit.MILLISECONDS);
      assertEquals(1, result.size());
    }
   
    @Test(expected=ExecutionException.class) public void testScheduleException() throws Exception {
      ThreadReuseExecutor pool = new ThreadReuseExecutor("test", 5); //$NON-NLS-1$
View Full Code Here

Examples of org.testng.internal.thread.GroupThreadPoolExecutor.awaitTermination()

      GroupThreadPoolExecutor executor = new GroupThreadPoolExecutor(this, xmlTest,
          threadCount, threadCount, 0, TimeUnit.MILLISECONDS,
          new LinkedBlockingQueue<Runnable>(), graph);
      executor.run();
      try {
        executor.awaitTermination(10000, TimeUnit.SECONDS);
        executor.shutdownNow();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }
View Full Code Here

Examples of org.testng.internal.thread.IExecutor.awaitTermination()

    IExecutor exec= ThreadUtil.createExecutor(1, tm.getMethod().getName());
 
    InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, parameterValues);
    IFutureResult future= exec.submitRunnable(imr);
    exec.shutdown();
    boolean finished= exec.awaitTermination(tm.getTimeOut());
 
    if(!finished) {
      exec.stopNow();
      testResult.setThrowable(new ThreadTimeoutException("Method "
                                                  + tm.getMethod()
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.