Exemplo n.º 1
0
 void awaitHealthy() {
   this.monitor.enterWhenUninterruptibly(this.awaitHealthGuard);
   try {
     checkHealthy();
   } finally {
     this.monitor.leave();
   }
 }
Exemplo n.º 2
0
 void awaitHealthy(long timeout, TimeUnit unit) throws TimeoutException {
   this.monitor.enter();
   try {
     if (!this.monitor.waitForUninterruptibly(this.awaitHealthGuard, timeout, unit)) {
       throw new TimeoutException(
           "Timeout waiting for the services to become healthy. The following services have not started: "
               + Multimaps.filterKeys(
                   this.servicesByState,
                   Predicates.in(ImmutableSet.of(Service.State.NEW, Service.State.STARTING))));
     }
     checkHealthy();
   } finally {
     this.monitor.leave();
   }
 }