예제 #1
0
    @Override
    public void shutdown(final Callback<None> callback) {
      if (_shutdown.compareAndSet(false, true)) {
        _client.shutdown(
            new Callback<None>() {
              @Override
              public void onSuccess(None none) {
                try {
                  callback.onSuccess(none);
                } finally {
                  clientShutdown();
                }
              }

              @Override
              public void onError(Throwable e) {
                try {
                  callback.onError(e);
                } finally {
                  clientShutdown();
                }
              }
            });
      } else {
        callback.onError(new IllegalStateException("shutdown has already been requested."));
      }
    }
예제 #2
0
 @Override
 public void shutdown(Callback<None> callback) {
   _wrappedClient.shutdown(callback);
 }