You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/08/01 11:59:00 UTC

[jira] [Commented] (FLINK-7326) Remove Flink's futures from RegisteredRpcConnection

    [ https://issues.apache.org/jira/browse/FLINK-7326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16108776#comment-16108776 ] 

ASF GitHub Bot commented on FLINK-7326:
---------------------------------------

Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4440#discussion_r130587841
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/registration/RegisteredRpcConnection.java ---
    @@ -88,24 +86,17 @@ public void start() {
     		pendingRegistration = checkNotNull(generateRegistration());
     		pendingRegistration.startRegistration();
     
    -		Future<Tuple2<Gateway, Success>> future = pendingRegistration.getFuture();
    -
    -		Future<Void> registrationSuccessFuture = future.thenAcceptAsync(new AcceptFunction<Tuple2<Gateway, Success>>() {
    -			@Override
    -			public void accept(Tuple2<Gateway, Success> result) {
    -				targetGateway = result.f0;
    -				onRegistrationSuccess(result.f1);
    -			}
    -		}, executor);
    -
    -		// this future should only ever fail if there is a bug, not if the registration is declined
    -		registrationSuccessFuture.exceptionallyAsync(new ApplyFunction<Throwable, Void>() {
    -			@Override
    -			public Void apply(Throwable failure) {
    -				onRegistrationFailure(failure);
    -				return null;
    -			}
    -		}, executor);
    +		CompletableFuture<Tuple2<Gateway, Success>> future = pendingRegistration.getFuture();
    +
    +		future.whenCompleteAsync(
    +			(Tuple2<Gateway, Success> result, Throwable failure) -> {
    +				if (failure != null) {
    --- End diff --
    
    I somehow like the failure case treating being first. It something like a termination condition for recursion, you also start with it instead of the recursion step.


> Remove Flink's futures from RegisteredRpcConnection
> ---------------------------------------------------
>
>                 Key: FLINK-7326
>                 URL: https://issues.apache.org/jira/browse/FLINK-7326
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Distributed Coordination
>    Affects Versions: 1.4.0
>            Reporter: Till Rohrmann
>            Assignee: Till Rohrmann
>            Priority: Minor
>             Fix For: 1.4.0
>
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)