Package java.util.concurrent

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


        }

        // wait for bad key writer to shutdown
        badKeyWriterService.shutdown();
        try {
            badKeyWriterService.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
        } catch(InterruptedException e) {
            e.printStackTrace();
            fail("Unexpected exception");
        }
View Full Code Here


        if(logger.isInfoEnabled())
            logger.info("Shutting down");

        isRunning.set(false);
        threadPool.shutdown();
        threadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);

        assertEquals(hostNamePairs.size(), failureDetector.getAvailableNodeCount());
    }

    private void test(StoreClient<String, String> store) {
View Full Code Here

                });
            }

            runner.shutdown();
            runner.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
            long time = (System.nanoTime() - start) / Time.NS_PER_MS;

            System.err.println("Time: " + time + " ms.");
        } finally {
            runner.shutdown();
View Full Code Here

        while(iter.hasNext())
            iter.next();
        iter.close();
        keepRunning.set(false);
        executor.shutdown();
        assertTrue(executor.awaitTermination(5, TimeUnit.SECONDS));
    }

    @Test
    public void testNativeBackup() throws Exception {
        File backupToDir = File.createTempFile("bdb-storage", "bkp");
View Full Code Here

              addListener(examinedListener);
            }

            notificationsPool.shutdown();
            condition.set(false);
            assertTrue(notificationsPool.awaitTermination(TIMEOUT, TimeUnit.SECONDS));

            if (totalListenersFailures != 0) {
                // If no listener failures, then all the listeners do not report any failure.
                int countTestFailures = examinedListeners.length - countReportedTestFailures(examinedListeners);
                assertThat(totalListenersFailures, is(countTestFailures));
View Full Code Here

                    fNotifier.fireTestStarted(null);
                }
            });
        }
        pool.shutdown();
        assertTrue(pool.awaitTermination(TIMEOUT, TimeUnit.SECONDS));

        fNotifier.removeListener(listener1);
        fNotifier.removeListener(listener2);

        assertThat(listener1.fTestStarted.get(), is(numParallelTests));
View Full Code Here

        List<Future<Boolean>> results = tp.invokeAll(tasks);
        for (Future<Boolean> future : results) {
            Assert.assertTrue(future.get(1, TimeUnit.SECONDS));
        }
        tp.shutdown();
        tp.awaitTermination(10, TimeUnit.SECONDS);
    }

    public void shouldParseLongValue() {
        long l=Long.MAX_VALUE;
        assertThat(jsonParser.parse(""+l).asLong(), is(l));
View Full Code Here

            }
         });
      }

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

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

   }
View Full Code Here

         });

      }

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

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

   }
View Full Code Here

    public void runsRegisteredHealthChecksInParallel() throws Exception {
        final ExecutorService executor = Executors.newFixedThreadPool(10);
        final Map<String, HealthCheck.Result> results = registry.runHealthChecks(executor);

        executor.shutdown();
        executor.awaitTermination(1, TimeUnit.SECONDS);

        assertThat(results)
                .contains(entry("hc1", r1));

        assertThat(results)
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.