Skip to content

Commit

Permalink
[hotfix][network] Enhance the constructor of ResultPartitionID
Browse files Browse the repository at this point in the history
Add the tag of VisibleForTesting for the constructor used for tests and checkNotNull for parameters.
  • Loading branch information
zhijiangW committed Jun 19, 2019
1 parent f75758e commit c12caf7
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -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}.
*
Expand All @@ -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() {
Expand Down

0 comments on commit c12caf7

Please sign in to comment.