public void waitUntilClosed() throws InterruptedException {
  mutex.lock();
  try {
    while (state != State.Closed) {
      isClosedCondition.await();
    }
  }
  finally {
    mutex.unlock();
  }
}

public void waitUntilClosed ( ) throws InterruptedException { mutex . lock ( ) ; try { while ( state != State . Closed ) { isClosedCondition . await ( ) ; } } finally { mutex . unlock ( ) ; } }
block until the service is finally closed
