Class RefCnt

java.lang.Object
org.apache.hbase.thirdparty.io.netty.util.AbstractReferenceCounted
org.apache.hadoop.hbase.nio.RefCnt
All Implemented Interfaces:
org.apache.hbase.thirdparty.io.netty.util.ReferenceCounted

@Private public class RefCnt extends org.apache.hbase.thirdparty.io.netty.util.AbstractReferenceCounted
Maintain an reference count integer inside to track life cycle of ByteBuff, if the reference count become 0, it'll call ByteBuffAllocator.Recycler.free() exactly once.
  • Field Details

  • Constructor Details

  • Method Details

    • create

      public static RefCnt create()
      Create an RefCnt with an initial reference count = 1. If the reference count become zero, the recycler will do nothing. Usually, an Heap 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.
    • create

      public static RefCnt create(ByteBuffAllocator.Recycler recycler)
    • hasRecycler

      public boolean hasRecycler()
      Returns true if this refCnt has a recycler.
    • retain

      public org.apache.hbase.thirdparty.io.netty.util.ReferenceCounted retain()
      Specified by:
      retain in interface org.apache.hbase.thirdparty.io.netty.util.ReferenceCounted
      Overrides:
      retain in class org.apache.hbase.thirdparty.io.netty.util.AbstractReferenceCounted
    • retain

      public org.apache.hbase.thirdparty.io.netty.util.ReferenceCounted retain(int increment)
      Specified by:
      retain in interface org.apache.hbase.thirdparty.io.netty.util.ReferenceCounted
      Overrides:
      retain in class org.apache.hbase.thirdparty.io.netty.util.AbstractReferenceCounted
    • release

      public boolean release()
      Specified by:
      release in interface org.apache.hbase.thirdparty.io.netty.util.ReferenceCounted
      Overrides:
      release in class org.apache.hbase.thirdparty.io.netty.util.AbstractReferenceCounted
    • release

      public boolean release(int decrement)
      Specified by:
      release in interface org.apache.hbase.thirdparty.io.netty.util.ReferenceCounted
      Overrides:
      release in class org.apache.hbase.thirdparty.io.netty.util.AbstractReferenceCounted
    • deallocate

      protected final void deallocate()
      Specified by:
      deallocate in class org.apache.hbase.thirdparty.io.netty.util.AbstractReferenceCounted
    • touch

      public RefCnt touch()
      Specified by:
      touch in interface org.apache.hbase.thirdparty.io.netty.util.ReferenceCounted
      Overrides:
      touch in class org.apache.hbase.thirdparty.io.netty.util.AbstractReferenceCounted
    • touch

      public final org.apache.hbase.thirdparty.io.netty.util.ReferenceCounted touch(Object hint)
    • getRecycler

    • maybeRecord

      private void maybeRecord()
    • maybeRecord

      private void maybeRecord(Object hint)