users@tyrus.java.net

Re: get open sessions

From: Danny Coward <danny.coward_at_oracle.com>
Date: Thu, 21 Feb 2013 16:05:32 -0800

On 2/21/13 12:01 PM, Andy Moncsek wrote:
> Hi,
> currently the only way to get all open session
> is session.getOpenSessions(); Some versions before there was something
> like context.getSession() (if I remember correct).
> Will there be any other way to get all active sessions without a
> session object? I am a bit confused if it is a good approach to access
> other session through a session object? The Endpoint contains all the
> open sessions but I cant find a way to access the endpoint directly.
> How about clustering the glassfish? Is it already possible to
> getOpenSessions() in a cluster?
>
> Thank you
>
> Andy

Hi Andy,

Before the last draft getOpenSessions() was on the container. This
presents a problem because it retrieved all the open sessions for all
the endpoints in an application. The use case for this is really for a
single endpoint to be able to easily broadcast an update to its
connected clients (and not the connected clients of other endpoints in
the application). So, the call being there had a few problems:

- it didn't fit the usecase, except when there was only one endpoint in
the application
- it didn't scale to large websocket applications

With the call on the session its easier to scope it to just the open
sessions on the endpoint for that session.

What is it you need to be able to do ? AT what point in the application
lifecycle are you trying to get the open sessions ?

Thanks,

- Danny





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