jsr356-experts@websocket-spec.java.net

[jsr356-experts] Re: Encoder/Decoder consistency

From: Mark Thomas <mark_at_homeinbox.net>
Date: Wed, 27 Feb 2013 09:17:48 -0800

On 26/02/2013 14:32, Danny Coward wrote:
> Hi folks,
>
> RIght now we have an inconsistency between the way we manage encoders
> and decoders for programmatic endpoints verses for annotated endpoints.
>
> For programmatic endpoints, we register instances of them with the
> EndpointConfiguration. So there is one instance of each encoder or
> decoder per logical endpoint. So in the typical one endpoint instance
> per connection, there are multiple possibly concurrent calls to
> encode/decode to the same encoder or decoder.
>
> For annotated endpoints, we register the encoder/decoder by class, and
> we say there is one instance of the encoder per endpoint per connection.
>
> Since Encoders and Decoders don't know whether they are being attached
> to programmatic or annotated endpoints, I think they should have the
> same cardinality whichever endpoint type they are used in.
>
> So I'm proposing to define Encoders and Decoders follow the same
> cardinality as for annotated endpoints, and so we switch the
> registration of Encoders and Decoders on EndpointConfiguration to be by
> class, not by instance.
>
> Secondly, it may be useful to allow Encoders and Decoders a view into
> the EndpointConfiguration instance they are attached to at runtime,
> perhaps they could even share data using the property bag. So, add
>
> public void setEndpointConfiguration(EndpointConfiguration ec)
>
> to both Encoder and Decoder.
>
> What do folks think about both the consistency issue and the access to
> the Config instance ?

No objections here.

Mark