eaglewatcherwb commented on a change in pull request #8290: [FLINK-12070] 
[network] Implement new bounded blocking subpartitions
URL: https://github.com/apache/flink/pull/8290#discussion_r281905867
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/BoundedBlockingSubpartitionReader.java
 ##########
 @@ -0,0 +1,191 @@
+/*
+ * 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.io.network.partition;
+
+import org.apache.flink.runtime.io.network.buffer.Buffer;
+import 
org.apache.flink.runtime.io.network.partition.ResultSubpartition.BufferAndBacklog;
+
+import javax.annotation.Nullable;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.Iterator;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
+/**
+ * The reader (read view) of a BoundedBlockingSubpartition.
+ */
+class BoundedBlockingSubpartitionReader implements ResultSubpartitionView {
+
+       /** The result subpartition that we read. */
+       private final BoundedBlockingSubpartition parent;
+
+       /** Further byte buffers, to handle cases where there is more data than 
fits into
+        * one mapped byte buffer (2GB = Integer.MAX_VALUE). */
+       private final Iterator<ByteBuffer> furtherData;
+
+       /** The reader/decoder to the memory mapped region with the data we 
currently read from.
+        * Max 2GB large. Further regions may be in the {@link #furtherData} 
field.
+        * Null once the reader empty or disposed.*/
+       @Nullable
+       private BoundedBlockingSubpartitionMemory.Reader data;
+
+       /** The next buffer (look ahead). Null once the data is depleted or 
reader is disposed. */
+       @Nullable
+       private Buffer nextBuffer;
+
+       /** The remaining number of data buffers (not events) in the result. */
+       private int bufferBacklog;
+
+       /** Flag whether this reader is released. Atomic, to avoid double 
release. */
+       private boolean isReleased;
+
+       /**
+        * Convenience constructor that takes a single buffer.
+        */
+       BoundedBlockingSubpartitionReader(
 
 Review comment:
   never used constructor

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to