Affects Version/s: None
Fix Version/s: None
I see several issues with the Session interface:
- The use of type parameter is weird - session is not typed when it gets created, so how/when would the type argument be supplied? I think it should be removed. Same for the RemoteEndpoint.
- It has setEncoders() method, but encoders come from the configuration (or annotation) - so what for? And there is no setDecoders() - seems weird. Also, there is no getEncoders(), so I can't just add to the existing set. IMHO it does not make much sense to modify decoders/encoders during the session, so I'd prefer readonly session attributes, but if that is not acceptable, it should at least be consistent.
- I can set max message size (both binary and text), while the config has max text buffer and max binary buffer sizes. This should be synced up. And again, it is questionable IMO if it makes sense to change these for the running session, so probably getters would be good enough.
- Session.getTimeout() vs. Container.getMaxSessionIdleTimeout() - should the names of these two methods be the same?
- why does getMessageHandlers() return an unmodifiable copy, while there are methods for adding/removing message handlers? Session would be running in a single thread (unless user explicitly spawns another one), so there should be no concurrency issues, no?
- getRemoteL() method does not make any sense to me. The type parameter in the method is taken from the type argument of Session. So why does user have to pass Class as a parameter. Moreover, as I mentioned in the first bullet, I don't think this is a good use of the type parameter - IMO this method should be removed.
- getParameterMap() should be immutable, but returns arrays as values - it is not possible to make arrays immutable, so should rather return Map<String, List<String>>. Also simply calling it getParameters() may be better.
- still missing Map<String, Object> getProperties() method for storing session-related data.
And one more
- missing Map<String, String> getPathParameters() method
(These from Martin)