[
https://issues.apache.org/jira/browse/QPID-2653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12877095#action_12877095
]
Robbie Gemmell commented on QPID-2653:
--------------------------------------
The original code, whilst a bit odd looking, does ensure that only 1 new buffer
is added to the map. The patch does not, as it synchronizes after checking
whether tehre was anything in the map and so multiple threads waiting on the
lock could then add to the map. I would look at synchronizing/locking around
the get and put.
> Double checked locking in org.apache.qpid.server.transport.ThreadPoolFilter
> ---------------------------------------------------------------------------
>
> Key: QPID-2653
> URL: https://issues.apache.org/jira/browse/QPID-2653
> Project: Qpid
> Issue Type: Bug
> Components: Java Broker
> Affects Versions: 0.7
> Reporter: Sorin Suciu
> Priority: Minor
> Fix For: 0.7
>
> Attachments:
> 0001-Double-checked-locking-in-org.apache.qpid.server.tra.patch
>
>
> org.apache.qpid.server.transport.ThreadPoolFilter has a double check locking
> in this method:
> private SessionBuffer getSessionBuffer(IoSession session)
> {
> final Map buffers = this.buffers;
> SessionBuffer buf = (SessionBuffer) buffers.get(session);
> if (buf == null)
> {
> synchronized (buffers)
> {
> buf = (SessionBuffer) buffers.get(session);
> if (buf == null)
> {
> buf = new SessionBuffer(session);
> buffers.put(session, buf);
> }
> }
> }
> return buf;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]