jsr343-experts@jms-spec.java.net

[jsr343-experts] Re: [jms-spec users] Re: Discussion point: deadlocks in MessageListener and ExceptionListener

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Wed, 03 Aug 2011 10:47:53 +0100

Graham,

On 02/08/2011 18:21, Graham Wallis wrote:

> I was thinking that during receive() the thread called ExceptionListener,
> and ExceptionListener tried to stop the connection, that would be similar
> to the MessageListener case.

I think the difference is that the spec (4.3.4) explicitly states that stop() needs to wait for
(b) delivery of messages to be paused
(a) all onMessage() calls to return.
However it doesn't say anything about needing to wait for onException() calls to return.

>
>> If there were a problem with the connection, then receive() could
>> throw a (different) exception anyway.
>
> Agreed - but we have seen providers invoking our ExceptionListener -
> although I can't recall whether it was from receive() - and causing the
> deadlock described.
>

Are you saying that with some providers, calling stop() from onException() will always block forever?

If so, then we could clarify the spec to say either
(1) stop() and close() cannot be called from onException() OR
(2) stop() is not required to wait for any onException() calls to return

I think the current spec is closer to (2) than (1). Which do you prefer?

Nigel