@Override
  public void notifyUnlock(LlapCacheableBuffer buffer) {
    // In the very rare chance that a buffer was marked but then accessed again we remove the mark from it
    // - except if instant deallocation is turned on of course -
    if (proactiveEvictionEnabled && !instantProactiveEviction) {
      buffer.removeProactiveEvictionMark();
    }

    if (Thread.currentThread() instanceof LlapPooledIOThread) {
      BPWrapper bpWrapper = threadLocalBPWrapper.get();

      // This will only block in a very very rare scenario only.
      bpWrapper.lock.lock();
      try {
        final LlapCacheableBuffer[] cacheableBuffers = bpWrapper.buffers;
        if (bpWrapper.count < maxQueueSize) {
          cacheableBuffers[bpWrapper.count] = buffer;
          ++bpWrapper.count;
        }
        if (bpWrapper.count <= maxQueueSize / 2) {
          // case too early to flush
          return;
        }

        if (bpWrapper.count == maxQueueSize) {
          // case we have to flush thus block on heap lock
          bpWrapper.flush();
          return;
        }
        bpWrapper.tryFlush(); //case 50% < queue usage < 100%, flush is preferred but not required yet
      } finally {
        bpWrapper.lock.unlock();
      }
    } else {
      heapLock.lock();
      try {
        doNotifyUnderHeapLock(buffer);
      } finally {
        heapLock.unlock();
      }
    }
  }
Wraps around the structures used in thread locals and buffers instances of LlapCachableBuffers in order to prevent
lock contention in LRFU during buffer ingress initiated heap access.
llap-server/src/java/org/apache/hadoop/hive/llap/cache/LowLevelLrfuCachePolicy.java