activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tabish...@gmail.com>
Subject Re: how to safely delete a cms::MessageListener object
Date Fri, 16 Jan 2015 17:21:16 GMT
On 01/16/2015 12:09 PM, Steve Rice wrote:
> So if the thread wanting to shut down the Message Listening sets the message
> listener to NULL, the setMessageListener call will not return until there is
> no onMessage function in progress?
>
> And so, after the setMessageListener(NULL) call returns, it is safe to
> delete the MessageListener object?
>
> Steve Rice
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/how-to-safely-delete-a-cms-MessageListener-object-tp4689939p4690057.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> .
>
That is correct, you can see this in the source of setMessageListener 
which locks on the listenerMutex which is held during onMessage calls to 
prevent the problem you are trying to avoid.

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Mime
View raw message