jsr356-experts@websocket-spec.java.net

[jsr356-experts] Concurrency questions

From: Mark Thomas <mark_at_homeinbox.net>
Date: Tue, 29 Jan 2013 09:42:04 +0000

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.

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