@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.")); } }
@Override public void restRequest( RestRequest request, RequestContext requestContext, Map<String, String> wireAttrs, TransportCallback<RestResponse> callback) { _client.restRequest(request, requestContext, wireAttrs, callback); }
@Override public void streamRequest( StreamRequest request, RequestContext requestContext, Map<String, String> wireAttrs, TransportCallback<StreamResponse> callback) { _wrappedClient.streamRequest(rewriteRequest(request), requestContext, wireAttrs, callback); }
@Override public void shutdown(Callback<None> callback) { _wrappedClient.shutdown(callback); }