@Override public void onFailure(Call<T> call, Throwable t) { promise.failure(t); } });
@Override public void onFailure(Call<T> call, Throwable t) { promise.failure(t); } });
@Override public void onResponse(Call<T> call, Response<T> response) { if (response.isSuccessful()) { promise.success(response.body()); } else { promise.failure(new HttpException(response)); } }
/** * Completes the promise with an exception * * @param t The exception to fail the promise with */ public void failure(Throwable t) { this.promise.failure(t); }
public boolean onThrowable(Flow f, Throwable t) { result.failure(t); // The exception is handled by the owner of the promise and should not be rethrown return true; } });
@Override public void onThrowable(Throwable t) { scalaPromise.failure(t); } });
@Override public void onError(Throwable throwable) { promise.failure(throwable); } @Override
public boolean onThrowable(Flow f, Throwable t) { result.failure(t); // The exception is handled by the owner of the promise and should not be rethrown return true; } });
@Override public void onThrowable(Throwable t) { scalaPromise.failure(t); } }
@Override public void onThrowable(Throwable t) { scalaPromise.failure(t); } }
@Override public void onFailure(final Throwable failure) { LOG.warn("Unable to retrieve schema source from provider", failure); promise.failure(failure); } }, MoreExecutors.directExecutor());
@Override public void onFailure(Throwable t) { LOG.warn("Unable to retrieve schema source from provider", t); promise.failure(t); } });
@Override public void handleError(Exception exception) { if (!connectionInfo.isCompleted()) { connectionInfo.failure(exception); } } }
@Override public void cancelled() { circuitBreaker.markFailure(); promise.failure(CANCEL_EXCEPTION); } }
@Override public void handleError(Exception exception) { if (!connectionInfo.isCompleted()) { connectionInfo.failure(exception); } } }
@Override public void handleError(Exception exception) { if (!futureActorGateway.isCompleted()) { futureActorGateway.failure(exception); } }
@Override public void notifyLeaderAddress(String leaderAddress, UUID leaderSessionID) { if (leaderAddress != null && !leaderAddress.equals("") && !connectionInfo.isCompleted()) { try { final LeaderConnectionInfo leaderConnectionInfo = new LeaderConnectionInfo(leaderAddress, leaderSessionID); connectionInfo.success(leaderConnectionInfo); } catch (FlinkException e) { connectionInfo.failure(e); } } }
@Override public void notifyLeaderAddress(String leaderAddress, UUID leaderSessionID) { if (leaderAddress != null && !leaderAddress.equals("") && !connectionInfo.isCompleted()) { try { final LeaderConnectionInfo leaderConnectionInfo = new LeaderConnectionInfo(leaderAddress, leaderSessionID); connectionInfo.success(leaderConnectionInfo); } catch (FlinkException e) { connectionInfo.failure(e); } } }
@Override public void notifyLeaderAddress(String leaderAddress, UUID leaderSessionID) { if (leaderAddress != null && !leaderAddress.equals("") && !connectionInfo.isCompleted()) { try { final LeaderConnectionInfo leaderConnectionInfo = new LeaderConnectionInfo(leaderAddress, leaderSessionID); connectionInfo.success(leaderConnectionInfo); } catch (FlinkException e) { connectionInfo.failure(e); } } }
CompletionStage<StandaloneWSResponse> execute(Request request) { final Promise<StandaloneWSResponse> scalaPromise = scala.concurrent.Promise$.MODULE$.apply(); AsyncCompletionHandler<Response> handler = new ResponseAsyncCompletionHandler(scalaPromise); try { asyncHttpClient.executeRequest(request, handler); } catch (RuntimeException exception) { scalaPromise.failure(exception); } Future<StandaloneWSResponse> future = scalaPromise.future(); return FutureConverters.toJava(future); }