openinx commented on a change in pull request #583: HBASE-22802 Avoid temp
ByteBuffer allocation in FileIOEngine#read
URL: https://github.com/apache/hbase/pull/583#discussion_r321150096
##########
File path: hbase-common/src/main/java/org/apache/hadoop/hbase/nio/RefCnt.java
##########
@@ -34,14 +33,30 @@
private Recycler recycler = ByteBuffAllocator.NONE;
/**
- * Create an {@link RefCnt} with an initial reference count = 1. If the
reference count become
- * zero, the recycler will do nothing. Usually, an Heap {@link ByteBuff}
will use this kind of
- * refCnt to track its life cycle, it help to abstract the code path
although it's not really
- * needed to track on heap ByteBuff.
+ * Usually, an Heap {@link ByteBuff} will use this kind of refCnt to track
its life cycle,
+ * it help to abstract the code path although it's not really needed to
track on heap ByteBuff.
*/
- public static RefCnt create() {
- return new RefCnt(ByteBuffAllocator.NONE);
- }
+ public static final RefCnt NONE = new RefCnt(ByteBuffAllocator.NONE) {
Review comment:
Is this right ? before we will create a RefCnt which will still
increase/decrement the its reference count value, but with a NONE de-allocator
to deallocate the memory (means donothing).... now we will create a RefCnt with
reference count value to be 1, and never change... I'm afraid that if upper
layer depends one the ref cnt value, then will be messed up..
----------------------------------------------------------------
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