Chunk getChunk() {
      Chunk chunk = reclaimedChunks.poll();
      if (chunk != null) {
        chunk.reset();
        reusedChunkCount.increment();
      } else {
        // Make a chunk iff we have not yet created the maxCount chunks
        while (true) {
          long created = this.chunkCount.get();
          if (created < this.maxCount) {
            if (this.chunkCount.compareAndSet(created, created + 1)) {
              chunk = createChunkForPool(chunkType, chunkSize);
              break;
            }
          } else {
            break;
          }
        }
      }
      return chunk;
    }
Poll a chunk from the pool, reset it if not null, else create a new chunk to return if we
have not yet created max allowed chunks count. When we have already created max allowed
chunks and no free chunks as of now, return null. It is the responsibility of the caller to
make a chunk then. Note: Chunks returned by this pool must be put back to the pool after its
use.
@return a chunk
@see #putbackChunks(Chunk)
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ChunkCreator.java