jsr356-experts@websocket-spec.java.net

[jsr356-experts] WebSocketContainer lifecycle concerns

From: Joakim Erdfelt <joakim_at_intalio.com>
Date: Wed, 31 Jul 2013 11:50:54 -0700

I have 2 main concerns about the 1.0 API I'd like to see discussed.

First, the WebSocketContainer (aka, the Client Container) has no clearly
defined lifecycle.
When is it to init/start?
When is it to finish/stop?

Second, ContainerProvider.getWebSocketContainer() is to return a new
instance of a javax.websocket.WebSocketContainer on every call. (per the
javadoc)

Is this really what is intended?
Or, like the server side's javax.websocket.server.ServerContainer, is there
to be only 1, and each call to ContainerProvicer.getWebSocketContainer()
returns the same instance (with the only nuance being that on a web
container, each webapp has its own WebSocketContainer instance)

If the implementation has resources that are managed to support the client
portions of the WebSocketContainer, when and how do we clean up those
resources? As there is no WebSocketContainer lifecycle [such as a .start()
and .stop()] then there is no real way to know if the user of the
WebSocketContainer is done with it.

Since API changes are not likely to occur, should we implement some sort of
safeguards into the ContainerProvider.getWebSocketContainer() if too many
WebSocketContainer references have been requested?

--
Joakim Erdfelt <joakim_at_intalio.com>
webtide.com <http://www.webtide.com/>
Developer advice, services and support
from the Jetty & CometD experts
eclipse.org/jetty - cometd.org