Package com.google.common.util.concurrent

Examples of com.google.common.util.concurrent.Service.stop()


      service.start();

      Assert.assertTrue(runLatch.await(2, TimeUnit.SECONDS));
      Assert.assertFalse(stopLatch.await(2, TimeUnit.SECONDS));

      service.stop();

      Assert.assertTrue(stopLatch.await(2, TimeUnit.SECONDS));

    } finally {
      zkServer.stopAndWait();
View Full Code Here


  public void testCompletion() throws ExecutionException, InterruptedException {
    Service service = new DummyService("s1", new AtomicBoolean());
    ListenableFuture<Service.State> completion = Services.getCompletionFuture(service);

    service.start();
    service.stop();

    completion.get();

    AtomicBoolean transiting = new AtomicBoolean();
    service = new DummyService("s2", transiting);
View Full Code Here

    service = new DummyService("s2", transiting);
    completion = Services.getCompletionFuture(service);

    service.startAndWait();
    transiting.set(true);
    service.stop();

    try {
      completion.get();
      Assert.assertTrue(false);
    } catch (ExecutionException e) {
View Full Code Here

      service.start();

      Assert.assertTrue(runLatch.await(2, TimeUnit.SECONDS));
      Assert.assertFalse(stopLatch.await(2, TimeUnit.SECONDS));

      service.stop();

      Assert.assertTrue(stopLatch.await(2, TimeUnit.SECONDS));

    } finally {
      zkServer.stopAndWait();
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.