Package com.google.common.util.concurrent.Service

Examples of com.google.common.util.concurrent.Service.Listener


   * called multiple times.
   */
  public void testManualServiceStopMultipleTimesWhileStarting() throws Exception {
    ManualSwitchedService service = new ManualSwitchedService();
    final AtomicInteger stopppingCount = new AtomicInteger();
    service.addListener(new Listener() {
      @Override public void stopping(State from) {
        stopppingCount.incrementAndGet();
      }
    }, directExecutor());

View Full Code Here


    assertFalse(thread + " is deadlocked", thread.isAlive());
  }

  public void testListenerDoesntDeadlockOnStartAndWaitFromRunning() throws Exception {
    final NoOpThreadedService service = new NoOpThreadedService();
    service.addListener(new Listener() {
      @Override public void running() {
        service.awaitRunning();
      }
    }, directExecutor());
    service.startAsync().awaitRunning(LONG_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
View Full Code Here

    service.stopAsync();
  }

  public void testListenerDoesntDeadlockOnStopAndWaitFromTerminated() throws Exception {
    final NoOpThreadedService service = new NoOpThreadedService();
    service.addListener(new Listener() {
      @Override public void terminated(State from) {
        service.stopAsync().awaitTerminated();
      }
    }, directExecutor());
    service.startAsync().awaitRunning();
View Full Code Here

        new WorkerProcess(FakeWorkers.createProcessBuilder(main, args),
            UUID.randomUUID(),
            getSocketFuture(),
            new RuntimeShutdownHookRegistrar()),
        TRIAL_NUMBER, parser, options, stdout);
    service.addListener(new Listener() {
      @Override public void starting() {}
      @Override public void running() {}
      @Override public void stopping(State from) {}
      @Override public void terminated(State from) {
        terminalLatch.countDown();
View Full Code Here

TOP

Related Classes of com.google.common.util.concurrent.Service.Listener

Copyright © 2018 www.massapicom. 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.