users@websocket-spec.java.net

[jsr356-users] [jsr356-experts] Encoder/Decoder consistency

From: Danny Coward <danny.coward_at_oracle.com>
Date: Tue, 26 Feb 2013 14:32:41 -0800

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 ?

- Danny


-- 
<http://www.oracle.com> 	*Danny Coward *
Java EE
Oracle Corporation