zhijiangW commented on a change in pull request #9903: [FLINK-14394][network]
Remove unnecessary interface method BufferProvider#requestBufferBlocking
URL: https://github.com/apache/flink/pull/9903#discussion_r335268176
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/BufferPoolFactory.java
##########
@@ -49,10 +50,10 @@
* minimum number of network buffers in this pool
* @param maxUsedBuffers
* maximum number of network buffers this pool offers
- * @param owner
- * the optional owner of this buffer pool to release memory
when needed
+ * @param bufferPoolOwner
+ * the owner of this buffer pool to release memory when needed
*/
- BufferPool createBufferPool(int numRequiredBuffers, int maxUsedBuffers,
Optional<BufferPoolOwner> owner) throws IOException;
+ BufferPool createBufferPool(int numRequiredBuffers, int maxUsedBuffers,
@Nullable BufferPoolOwner bufferPoolOwner) throws IOException;
Review comment:
> Instead of @Nullable you can just use overloaded method without the
special parameter.
We could remove `@Nullable` from this interface method, but it is still
needed in specific implementation of `NetworkBufferPool#createBufferPool(int
numRequiredBuffers, int maxUsedBuffers, @Nullable BufferPoolOwner
bufferPoolOwner)`, because `NetworkBufferPool#createBufferPool(int
numRequiredBuffers, int maxUsedBuffers)` would reuse the above method to pass
`null`. Or I did not get the point?
> We should avoid @Nullable parameters/return values. Having @Nullable
private field is a lesser evil, as it's encapsulated by the current class and
the nullability is not leaking to the interface/class users.
Totally agree with this general idea.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services