class CompletableResultCode {

  public CompletableResultCode join(long timeout, TimeUnit unit) {
    if (isDone()) {
      return this;
    }
    final CountDownLatch latch = new CountDownLatch(1);
    whenComplete(
        new Runnable() {
          @Override
          public void run() {
            latch.countDown();
          }
        });
    try {
      if (!latch.await(timeout, unit)) {
        fail();
      }
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      fail();
    }
    return this;
  }

  public  CompletableResultCode();

}