|<< Back to previous view|
[WEBSOCKET_SPEC-37] Consider changing number of endpoint instances Created: 17/Oct/12 Updated: 10/Nov/12 Due: 09/Nov/12 Resolved: 10/Nov/12
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
Currently the spec defines there is one endpoint instance per URI per VM. So the endpoint instance is application scoped.
Consider using one instance of an endpoint per client. This simplifies the threading model, but removes the ability of the developer to use the endpoint to share state that is common to multiple requests.
The developer needs to be able to hold application-wide state AND session state, so this is related to the issue of having a place to associate user data with the session.
The JAX-RS spec defines its endpoint instances to be request scoped by default, but this can be overridden so that they are application scoped to.
If we make the endpoint a CDI managed bean, then we can allow different modes.
|Comment by dannycoward [ 10/Nov/12 12:05 AM ]|
I agree with Scott that this is a good change: to require a new instance of the Endpoint per session. It greatly simplifies the developer model in regard to having to deal with multiple threads. Ditto for the POJOs. So I propose we make this change in the next draft.
The consequences for this change are:-
1) we need to change the server publish method to take the endpoint class rather than one instance:
2) client registration: no change - one client instance connects to one URL.
3) drop the Session parameter from Endpoint.onError, Endpoint.onClose as they are no longer necessary: the Endpoint instance gets the reference to its (single) Session instance just on the onOpen method.