From c12caf7b2df05fb15ea65d0ca79e92b735aa427b Mon Sep 17 00:00:00 2001 From: Zhijiang Date: Tue, 18 Jun 2019 16:26:11 +0800 Subject: [PATCH] [hotfix][network] Enhance the constructor of ResultPartitionID Add the tag of VisibleForTesting for the constructor used for tests and checkNotNull for parameters. --- .../runtime/io/network/partition/ResultPartitionID.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionID.java b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionID.java index cee79a0d2a0e6d..fd6e68b068c7c9 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionID.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionID.java @@ -18,12 +18,15 @@ package org.apache.flink.runtime.io.network.partition; +import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.runtime.executiongraph.ExecutionAttemptID; import org.apache.flink.runtime.executiongraph.IntermediateResultPartition; import org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID; import java.io.Serializable; +import static org.apache.flink.util.Preconditions.checkNotNull; + /** * Runtime identifier of a produced {@link IntermediateResultPartition}. * @@ -39,13 +42,14 @@ public final class ResultPartitionID implements Serializable { private final ExecutionAttemptID producerId; + @VisibleForTesting public ResultPartitionID() { this(new IntermediateResultPartitionID(), new ExecutionAttemptID()); } public ResultPartitionID(IntermediateResultPartitionID partitionId, ExecutionAttemptID producerId) { - this.partitionId = partitionId; - this.producerId = producerId; + this.partitionId = checkNotNull(partitionId); + this.producerId = checkNotNull(producerId); } public IntermediateResultPartitionID getPartitionId() {