Package java.util.concurrent

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


      }

      executor.shutdown();
      executor.awaitTermination(20, TimeUnit.SECONDS);
      executor.shutdownNow();

      assertEquals(NUMBER_OF_THREADS * REQUESTS_PER_THREAD, successCounter.get());

   }
}
View Full Code Here


        Thread.sleep(1000L);

        assertFalse("The main() method did not measurement the load values", TestLS.measurementTime == 0);
        // There's no point in testing further, since we're really testing the
        // parse() method.  We'll do that in testParse().
        es.shutdownNow();

        // TODO: Need to figure out how to test this
//        try {
//            LoadSensorManager.main(new String[0]);
//            fail("The main() method did not fail on no args");
View Full Code Here

                throw new AssertionError(e);
            } catch (Exception e) {
                throw new IOException(e);
            }
        } finally {
            executor.shutdownNow();
            while (true) {
                Pair next = queue.poll();
                if (next == null) {
                    break;
                }
View Full Code Here

            ExecutorService executor = Executors.newFixedThreadPool(threads, DAEMON_THREAD_FACTORY);
            try {
                BatchFileCacheRepository repo = new ConcurrentBatchFileCacheRepository(unit, executor);
                return repo.resolve(libraryPaths);
            } finally {
                executor.shutdownNow();
            }
        } else {
            return new NullBatchFileCacheRepository().resolve(libraryPaths);
        }
    }
View Full Code Here

            executor.shutdown();
            if (executor.awaitTermination(30, TimeUnit.SECONDS) == false) {
                throw new TimeoutException();
            }
        } finally {
            executor.shutdownNow();
        }
        for (Future<Path> future : futures) {
            future.get();
        }
    }
View Full Code Here

                e.printStackTrace();
            } finally {
                AccessController.doPrivileged(new PrivilegedAction<Object>() {
                    public Object run() {
                        future.cancel(true);
                        cachePool.shutdownNow();
                        return null;
                    }
                });
            }
            return null;
View Full Code Here

                    long end = System.nanoTime();
                    long elapsed = TimeUnit.NANOSECONDS.toMillis(end - start);
                    System.out.println("elapsed ms: " + elapsed);

                    for (Worker worker : workers) worker.stop();
                    executor.shutdownNow();

                    // Perform one request to get the result
                    ContentExchange exchange2 = new ContentExchange(true);
                    exchange2.setMethod(HttpMethods.GET);
                    exchange2.setURL(urls[0] + "?action=result");
View Full Code Here

            e.printStackTrace();
        } finally {
            AccessController.doPrivileged(new PrivilegedAction<Object>() {
                public Object run() {
                    future.cancel(true);
                    cachePool.shutdownNow();
                    return null;
                }
            });
           
            this.logger.status("remoteproxytodiscovery/end");
View Full Code Here

                    long end = System.nanoTime();
                    long elapsed = TimeUnit.NANOSECONDS.toMillis(end - start);
                    System.out.println("elapsed ms: " + elapsed);

                    for (Worker worker : workers) worker.stop();
                    executor.shutdownNow();

                    // Perform one request to get the result
                    ContentExchange exchange2 = new ContentExchange(true);
                    exchange2.setMethod(HttpMethods.GET);
                    exchange2.setURL(urls[0] + "?action=result");
View Full Code Here

            e.printStackTrace();
        } catch (final SecurityException e) {
            e.printStackTrace();
        } finally {
            System.out.println("Cancelling");
            newCachedThreadPool.shutdownNow();
            submit.cancel(true);
        }

        System.out.println("xx");
    }
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.