On 01/09/2010 12:01 AM, Jason Jones wrote:
void
MyMessageHandler::stop()
{
if(0 != subscriptionManager_)
{
// I think order matters on these two lines
subscriptionManager_->stop();
subscription_.cancel();
delete subscriptionManager_;
subscriptionManager_ = 0;
}
}
I would cancel the subscription before stopping, but that is unlikely to
be the issue here (and will in any case still allow for the possibility
that there are messages for that subscription already on the dispatch
queue waiting to be processed).
However the return of subscriptionManager_->stop() does not mean that
the dispatch thread has stopped and so you ,ay be deleting the
subscription manager from under the dispatching thread. To fix that you
would need to call subscriptionManager_->wait() before deleting it. From
the stack trace I think that may be the problem you are seeing.
Note that there is a problem with SubscriptionManager::start() in that
you are unable to handle any exceptions thrown during dispatching. For
that reason I would advocate using SubscriptionManager::run(), starting
your own thread for it if so desired.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]