pnowojski 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_r335331663
##########
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:
I think the way to avoid this `@Nullable` on public/protected method in this
case, is to have
```
public BufferPool createBufferPool(int numRequiredBuffers, int
maxUsedBuffers) {
return createBufferPool(numRequiredBuffers, maxUsedBuffers, null);
}
public BufferPool createBufferPool(int numRequiredBuffers, int
maxUsedBuffers, @NonNull owner) {
return createBufferPoolInternal(numRequiredBuffers, maxUsedBuffers, owner);
}
```
and internal helper method:
```
private BufferPool createBufferPoolInternal(int numRequiredBuffers, int
maxUsedBuffers, @Nullable owner)
```
But that's quite some overhead. This code bloat is one of the reasons why I
don't mind `Optional` as a parameter :(
LGTM regardless of the version that you pick.
----------------------------------------------------------------
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