Package java.util.concurrent

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


      barrier.await(); // wait for all threads to be ready
      barrier.await(); // wait for all threads to finish

      log.debug("All threads finished, let's shutdown the executor and check whether any exceptions were reported");
      for (Future<Void> future : futures) future.get();
      executorService.shutdownNow();
   }
}
View Full Code Here


                service.take().get();
            }
        }
        finally
        {
            executorService.shutdownNow();
            CloseableUtils.closeQuietly(client);
        }
    }

    @Test
View Full Code Here

                Assert.assertTrue(count <= (MAX_ITEMS * SLOP_FACTOR), counts.toString());
            }
        }
        finally
        {
            executor.shutdownNow();
            CloseableUtils.closeQuietly(client);
        }
    }

    @Test
View Full Code Here

      threadPool.shutdown();

    }
    finally {
      threadPool.shutdownNow();
    }
  }

  /**
   * Compute the out-of-bag error for a set of instances.
View Full Code Here

            throw e;
        } catch (InterruptedException e) {
            // should not happen
            throw new RuntimeException(e);
        } finally {
            executor.shutdownNow();
            try {
                executor.awaitTermination(timeout, unit);
            } catch (InterruptedException e) {
                // ignore
            }
View Full Code Here

    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) {
      addFailure(new Exception(String.format("test timed out after %d milliseconds", timeout)));
    } catch (Exception e) {
      addFailure(e);
View Full Code Here

         isUpMethod = NetworkInterface.class.getMethod("isUp");
         isLoopbackMethod = NetworkInterface.class.getMethod("isLoopback");
         isVirtualMethod = NetworkInterface.class.getMethod("isVirtual");
         // check if we have enough security permissions to create and shutdown an executor
         ExecutorService executor = Executors.newFixedThreadPool(0);
         executor.shutdownNow();
      }
      catch (Throwable t)
      {
         // not on Java 6 or not enough security permission
         return null;
View Full Code Here

      {
         return null;
      }
      finally
      {
         executor.shutdownNow();
      }
   }
}
View Full Code Here

            throw new RuntimeException(e);
        } catch (ExecutionException e) {
            // by virtue of the Callable redefinition above I can cast
            throw (IOException) e.getCause();
        } finally {
            executor.shutdownNow();
            try {
                executor.awaitTermination(timeout, unit);
            } catch (InterruptedException e) {
                // ignore
            }
View Full Code Here

            throw new RuntimeException("Could not stop container", e);
        } finally {
            safeCloseDomainClient();
            final ExecutorService exec = executor;
            if (exec != null) {
                exec.shutdownNow();
                executor = null;
            }
        }
    }
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.