On 1/29/13 1:42 AM, Mark Thomas wrote:
> All,
>
> As a side-effect of grappling with why some of my unit tests are failing
> I have been thinking about concurrency issues around message sending and
> have the following questions.
>
> 1) If an application sends a message using a Future or a SendHandler, is
> it permitted to send a second message before the first has completed?
> My current thinking is that this should not be permitted and an
> IllegalStateException be thrown
> My reasoning for this is that was allowed it would open up all sorts of
> buffering requirements for the container that could get tricky to manage.
Going back to this one, would you say the same thing if you tried to
send a second message while you were in the middle of sending a first
one in pieces ? For the same reason ?
i.e.
sendPartialString("inter", false); // not done
sendPartialString("rupti", false); // not done
sendString(" cow !"); <- throws IllegalStateException ?
sendPartialString("ng ", true);
Ditto for scnearios around the IO stream writers too ?
- Danny
>
> 2) How is 1) affected when batching is enabled?
> My current thinking is that the send is completed (via the Future or
> SendHandler) once the message has been batched but before it has been
> flushed. Otherwise it would be impossible to batch multiple messages.
>
> 3) What happens if a message is being sent and the container is required
> to send a Pong (there could be multiple Pongs) or a Close?
> My current thinking is:
> - for Pong the most recent Pong should be buffered and sent when the
> message has completed but before the application is notified of the
> completion
> - for close the first close should be buffered (and subsequent closes
> ignored) and sent sent when the message has completed but before the
> application is notified of the completion
>
> If I have missed something in the specification that clarifies any of
> the above please do point me in the right direction.
>
> Thoughts?
>
> Mark
--
<http://www.oracle.com> *Danny Coward *
Java EE
Oracle Corporation