Github user belliottsmith commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/288#discussion_r228448169
  
    --- Diff: src/java/org/apache/cassandra/utils/memory/BufferPool.java ---
    @@ -237,23 +237,25 @@ void check()
             /** Return a chunk, the caller will take owership of the parent 
chunk. */
             public Chunk get()
             {
    -            while (true)
    -            {
    -                Chunk chunk = chunks.poll();
    -                if (chunk != null)
    -                    return chunk;
    +            Chunk chunk = chunks.poll();
    +            if (chunk != null)
    +                return chunk;
     
    -                if (!allocateMoreChunks())
    -                    // give it one last attempt, in case someone else 
allocated before us
    -                    return chunks.poll();
    -            }
    +            chunk = allocateMoreChunks();
    +            if (chunk != null)
    +                return chunk;
    +
    +            /*  another thread may have just allocated last macro chunk, so
    +            **  make one final attempt before returning null
    --- End diff --
    
    Super minor nit, with way more verbiage than necessary to follow (on my 
part), but this is the first time I've seen this style of code comment in the 
codebase. 
    
    The norm is usually to use one of the two basic forms - short info comments 
just using // for each line, and larger explanatory comments using the standard:
     
    /** (this line typically left blank, for balance with terminating line, but 
not essential)
     *
     *
     */
    
    I'm sure we don't stick to this everywhere, and it's not super important 
which style of code comment you use, but it would be preferable to stick to one 
of the two most standard formats.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to