You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by 冯傲风 <fa...@outlook.com> on 2014/04/23 15:12:26 UTC

a problem about kafka source code‏

HiI am reading the kafka source code now. I have a problem about the "BufferPool" class int the file "org.apache.kafka.clients.producer.internals.BufferPool.java"the source code is like this:
this.lock.lock();        try {            // check if we have a free buffer of the right size pooled            if (size == poolableSize && !this.free.isEmpty())                return this.free.pollFirst();
the function returns a free memory without "unlock" operation?
I haven't found any issue about this in the jira web site. is it a mistake? or Do I misunderstand the code?
I'm sorry ,my english is poor.  look forward to your reply. 		 	   		  

Re: a problem about kafka source code‏

Posted by Jun Rao <ju...@gmail.com>.
It seems to call unlock in the finally clause.

Thanks,

Jun


On Wed, Apr 23, 2014 at 6:12 AM, 冯傲风 <fa...@outlook.com> wrote:

> HiI am reading the kafka source code now. I have a problem about the
> "BufferPool" class int the file
> "org.apache.kafka.clients.producer.internals.BufferPool.java"the source
> code is like this:
> this.lock.lock();        try {            // check if we have a free
> buffer of the right size pooled            if (size == poolableSize &&
> !this.free.isEmpty())                return this.free.pollFirst();
> the function returns a free memory without "unlock" operation?
> I haven't found any issue about this in the jira web site. is it a
> mistake? or Do I misunderstand the code?
> I'm sorry ,my english is poor.  look forward to your reply.
>