[3/3] flink git commit: [FLINK-4361] Introduce Flink's own future abstraction
[FLINK-4361] Introduce Flink's own future abstraction Flink's future abstraction whose API is similar to Java 8's CompletableFuture. That's in order to ease a future transition to this class once we ditch Java 7. The current set of operations comprises: - isDone to check the completion of the future - get/getNow to obtain the future's value - cancel to cancel the future (best effort basis) - thenApplyAsync to transform the future's value into another value - thenAcceptAsync to register a callback for a successful completion of the future - exceptionallyAsync to register a callback for an exception completion of the future - thenComposeAsync to transform the future's value and flatten the returned future - handleAsync to register a callback which is called either with the regular result or the exceptional result Additionally, Flink offers a CompletableFuture which can be completed with a regular value or an exception: - complete/completeExceptionally Complete FlinkCompletableFuture exceptionally with a CanellationException upon cancel Add convenience functions for FlinkCompletableFutures This closes #2554. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/f8138f4b Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/f8138f4b Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/f8138f4b Branch: refs/heads/master Commit: f8138f4b74332ecb4ef0d28a09e8549708118ca6 Parents: 6e123d2 Author: Till RohrmannAuthored: Fri Sep 2 21:13:34 2016 +0200 Committer: Till Rohrmann Committed: Tue Sep 27 18:39:36 2016 +0200 -- .../runtime/concurrent/AcceptFunction.java | 34 +++ .../flink/runtime/concurrent/ApplyFunction.java | 36 +++ .../flink/runtime/concurrent/BiFunction.java| 38 +++ .../runtime/concurrent/CompletableFuture.java | 47 .../apache/flink/runtime/concurrent/Future.java | 156 +++ .../concurrent/impl/FlinkCompletableFuture.java | 91 +++ .../runtime/concurrent/impl/FlinkFuture.java| 273 +++ .../runtime/concurrent/FlinkFutureTest.java | 269 ++ 8 files changed, 944 insertions(+) -- http://git-wip-us.apache.org/repos/asf/flink/blob/f8138f4b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/AcceptFunction.java -- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/AcceptFunction.java b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/AcceptFunction.java new file mode 100644 index 000..a300647 --- /dev/null +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/AcceptFunction.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.concurrent; + +/** + * Function which is called with a single argument and does not return a value. + * + * @param type of the argument + */ +public interface AcceptFunction { + + /** +* Method which handles the function call. +* +* @param value is the function's argument +*/ + void accept(T value); +} http://git-wip-us.apache.org/repos/asf/flink/blob/f8138f4b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ApplyFunction.java -- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ApplyFunction.java b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ApplyFunction.java new file mode 100644 index 000..64def98 --- /dev/null +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ApplyFunction.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version
[49/50] [abbrv] flink git commit: [FLINK-4361] Introduce Flink's own future abstraction
[FLINK-4361] Introduce Flink's own future abstraction Flink's future abstraction whose API is similar to Java 8's CompletableFuture. That's in order to ease a future transition to this class once we ditch Java 7. The current set of operations comprises: - isDone to check the completion of the future - get/getNow to obtain the future's value - cancel to cancel the future (best effort basis) - thenApplyAsync to transform the future's value into another value - thenAcceptAsync to register a callback for a successful completion of the future - exceptionallyAsync to register a callback for an exception completion of the future - thenComposeAsync to transform the future's value and flatten the returned future - handleAsync to register a callback which is called either with the regular result or the exceptional result Additionally, Flink offers a CompletableFuture which can be completed with a regular value or an exception: - complete/completeExceptionally Complete FlinkCompletableFuture exceptionally with a CanellationException upon cancel This closes #2472. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/f766f120 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/f766f120 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/f766f120 Branch: refs/heads/flip-6 Commit: f766f120e4af6b60a3e628836963eb981005325c Parents: 0a134a3 Author: Till RohrmannAuthored: Fri Sep 2 21:13:34 2016 +0200 Committer: Till Rohrmann Committed: Wed Sep 21 11:39:18 2016 +0200 -- .../runtime/concurrent/AcceptFunction.java | 34 +++ .../flink/runtime/concurrent/ApplyFunction.java | 36 +++ .../flink/runtime/concurrent/BiFunction.java| 38 +++ .../runtime/concurrent/CompletableFuture.java | 47 .../apache/flink/runtime/concurrent/Future.java | 156 +++ .../concurrent/impl/FlinkCompletableFuture.java | 71 + .../runtime/concurrent/impl/FlinkFuture.java| 273 +++ .../runtime/concurrent/FlinkFutureTest.java | 269 ++ 8 files changed, 924 insertions(+) -- http://git-wip-us.apache.org/repos/asf/flink/blob/f766f120/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/AcceptFunction.java -- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/AcceptFunction.java b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/AcceptFunction.java new file mode 100644 index 000..a300647 --- /dev/null +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/AcceptFunction.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.concurrent; + +/** + * Function which is called with a single argument and does not return a value. + * + * @param type of the argument + */ +public interface AcceptFunction { + + /** +* Method which handles the function call. +* +* @param value is the function's argument +*/ + void accept(T value); +} http://git-wip-us.apache.org/repos/asf/flink/blob/f766f120/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ApplyFunction.java -- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ApplyFunction.java b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ApplyFunction.java new file mode 100644 index 000..64def98 --- /dev/null +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ApplyFunction.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except
flink git commit: [FLINK-4361] Introduce Flink's own future abstraction
Repository: flink Updated Branches: refs/heads/flip-6 d159de62f -> 11cc6b95b [FLINK-4361] Introduce Flink's own future abstraction Flink's future abstraction whose API is similar to Java 8's CompletableFuture. That's in order to ease a future transition to this class once we ditch Java 7. The current set of operations comprises: - isDone to check the completion of the future - get/getNow to obtain the future's value - cancel to cancel the future (best effort basis) - thenApplyAsync to transform the future's value into another value - thenAcceptAsync to register a callback for a successful completion of the future - exceptionallyAsync to register a callback for an exception completion of the future - thenComposeAsync to transform the future's value and flatten the returned future - handleAsync to register a callback which is called either with the regular result or the exceptional result Additionally, Flink offers a CompletableFuture which can be completed with a regular value or an exception: - complete/completeExceptionally Complete FlinkCompletableFuture exceptionally with a CanellationException upon cancel This closes #2472. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/11cc6b95 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/11cc6b95 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/11cc6b95 Branch: refs/heads/flip-6 Commit: 11cc6b95bab5c3d17dd1182f3ad87df4184aaa4a Parents: d159de6 Author: Till RohrmannAuthored: Fri Sep 2 21:13:34 2016 +0200 Committer: Till Rohrmann Committed: Wed Sep 21 10:09:07 2016 +0200 -- .../runtime/concurrent/AcceptFunction.java | 34 +++ .../flink/runtime/concurrent/ApplyFunction.java | 36 +++ .../flink/runtime/concurrent/BiFunction.java| 38 +++ .../runtime/concurrent/CompletableFuture.java | 47 .../apache/flink/runtime/concurrent/Future.java | 156 +++ .../concurrent/impl/FlinkCompletableFuture.java | 71 + .../runtime/concurrent/impl/FlinkFuture.java| 273 +++ .../runtime/concurrent/FlinkFutureTest.java | 269 ++ 8 files changed, 924 insertions(+) -- http://git-wip-us.apache.org/repos/asf/flink/blob/11cc6b95/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/AcceptFunction.java -- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/AcceptFunction.java b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/AcceptFunction.java new file mode 100644 index 000..a300647 --- /dev/null +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/AcceptFunction.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.concurrent; + +/** + * Function which is called with a single argument and does not return a value. + * + * @param type of the argument + */ +public interface AcceptFunction { + + /** +* Method which handles the function call. +* +* @param value is the function's argument +*/ + void accept(T value); +} http://git-wip-us.apache.org/repos/asf/flink/blob/11cc6b95/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ApplyFunction.java -- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ApplyFunction.java b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ApplyFunction.java new file mode 100644 index 000..64def98 --- /dev/null +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ApplyFunction.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the