flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GJL <...@git.apache.org>
Subject [GitHub] flink pull request #5312: [FLINK-8344][WIP] Add support for HA to RestCluste...
Date Tue, 23 Jan 2018 07:25:47 GMT
Github user GJL commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5312#discussion_r163160802
  
    --- Diff: flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
---
    @@ -376,4 +430,99 @@ public GetClusterStatusResponse getClusterStatus() {
     	public int getMaxSlots() {
     		return 0;
     	}
    +
    +	//-------------------------------------------------------------------------
    +	// RestClient Helper
    +	//-------------------------------------------------------------------------
    +
    +	private <M extends MessageHeaders<EmptyRequestBody, P, U>, U extends MessageParameters,
P extends ResponseBody> CompletableFuture<P>
    +			sendRequest(M messageHeaders, U messageParameters) throws IOException, LeaderNotAvailableException
{
    +		return sendRequest(messageHeaders, messageParameters, EmptyRequestBody.getInstance());
    +	}
    +
    +	private <M extends MessageHeaders<R, P, EmptyMessageParameters>, R extends
RequestBody, P extends ResponseBody> CompletableFuture<P>
    +			sendRequest(M messageHeaders, R request) throws IOException, LeaderNotAvailableException
{
    +		return sendRequest(messageHeaders, EmptyMessageParameters.getInstance(), request);
    +	}
    +
    +	private <M extends MessageHeaders<EmptyRequestBody, P, EmptyMessageParameters>,
P extends ResponseBody> CompletableFuture<P>
    +			sendRequest(M messageHeaders) throws IOException, LeaderNotAvailableException {
    +		return sendRequest(messageHeaders, EmptyMessageParameters.getInstance(), EmptyRequestBody.getInstance());
    +	}
    +
    +	private <M extends MessageHeaders<R, P, U>, U extends MessageParameters, R
extends RequestBody, P extends ResponseBody> CompletableFuture<P>
    +			sendRequest(M messageHeaders, U messageParameters, R request) throws IOException,
LeaderNotAvailableException {
    +		final URL restServerBaseUrl = restServerLeaderHolder.getLeaderAddress();
    +		return restClient.sendRequest(restServerBaseUrl.getHost(), restServerBaseUrl.getPort(),
messageHeaders, messageParameters, request);
    +	}
    +
    +	private <M extends MessageHeaders<R, P, U>, U extends MessageParameters, R
extends RequestBody, P extends ResponseBody> CompletableFuture<P>
    +			sendRetryableRequest(M messageHeaders, U messageParameters, R request, Predicate<Throwable>
retryPredicate) {
    +		return retry(() -> {
    +			final URL restServerBaseUrl = restServerLeaderHolder.getLeaderAddress();
    --- End diff --
    
    done


---

Mime
View raw message