Package java.util.concurrent

Examples of java.util.concurrent.ExecutorService.awaitTermination()


            }
         });
      }

      executorService.shutdown();
      if(!executorService.awaitTermination(10, TimeUnit.HOURS)) {
         fail("Executor didn't finish all his tasks!");
      }

      if(throwableHolder.get() != null) {
         throw throwableHolder.get();
View Full Code Here


        if (createdExecutor) {
            ExecutorService e = (ExecutorService) executor;
            e.shutdown();
            while (!e.isTerminated()) {
                try {
                    e.awaitTermination(Integer.MAX_VALUE, TimeUnit.SECONDS);
                } catch (InterruptedException e1) {
                    // Ignore; it should end shortly.
                }
            }
        }
View Full Code Here

                });
            }
            pool.shutdown();
            try {
                // wait 1h
                pool.awaitTermination(ONE_HOUR, TimeUnit.SECONDS);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else if (first.startsWith("@")) {
            handleAt(first);
View Full Code Here

      }
    };
    Future<Object> result= service.submit(callable);
    service.shutdown();
    try {
      boolean terminated= service.awaitTermination(timeout,
          TimeUnit.MILLISECONDS);
      if (!terminated)
        service.shutdownNow();
      result.get(timeout, TimeUnit.MILLISECONDS); // throws the exception if one occurred during the invocation
    } catch (TimeoutException e) {
View Full Code Here

                });
            }
            pool.shutdown();
            try {
                // wait 1h
                pool.awaitTermination(ONE_HOUR, TimeUnit.SECONDS);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else if (first.startsWith("@")) {
            handleAt(first);
View Full Code Here

            }
         });
      }

      exec.shutdown();
      exec.awaitTermination(360, TimeUnit.SECONDS);

      long duration = System.currentTimeMillis() - startTime;
      log.warn("Finished warmup.  " + printDuration(duration));
      //cache.removeNode(Fqn.ROOT);
      cache.stop();
View Full Code Here

         if (USE_SLEEP) TestingUtil.sleepThread(MAX_RANDOM_SLEEP_MILLIS);
      }
      log.warn("Finished generating runnables; awaiting executor completion");
      // wait for executors to complete!
      exec.shutdown();
      exec.awaitTermination(((long) i), TimeUnit.SECONDS)// wait up to 1 sec for each call?
      long duration = System.currentTimeMillis() - startTime;
      log.warn("Finished test.  " + printDuration(duration));
   }

   enum Mode
View Full Code Here

            }
         });
      }

      exec.shutdown();
      exec.awaitTermination(360, TimeUnit.SECONDS);

      long duration = System.currentTimeMillis() - startTime;
      log.warn("Finished warmup.  " + printDuration(duration));
      //cache.removeNode(Fqn.ROOT);
      cache.stop();
View Full Code Here

         if (USE_SLEEP) TestingUtil.sleepThread(MAX_RANDOM_SLEEP_MILLIS);
      }
      log.warn("Finished generating runnables; awaiting executor completion");
      // wait for executors to complete!
      exec.shutdown();
      while (!exec.awaitTermination(((long) i), TimeUnit.SECONDS))
      {
         Thread.sleep(1);
      }
      // wait up to 1 sec for each call?
      long elapsedTimeNanos = System.nanoTime() - stElapsed;
View Full Code Here

            });
         }
      }

      e.shutdown();
      e.awaitTermination(60, TimeUnit.SECONDS);

      for (Throwable t : throwables)
      {
         t.printStackTrace();
      }
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.