users@tyrus.java.net

Re: get open sessions

From: Andy Moncsek <amo.ahcp_at_gmail.com>
Date: Sat, 23 Feb 2013 17:58:02 +0100

Hi Danny,

"because it retrieved all the open sessions for all the endpoints " .. I agree. "What is it you need to be able to do?" Ohh many things ;-) If I have N backoffice systemes communicating through one Endpoint the session.getOpenSessions() solution is fine. If you have in this scenario some external systems who wants to notify all BO's on this Endpoint you can do this only with a workaround (open a connection to this speciffic endpoint, send the message, close)... or you use thigs like SSE and notify your connected applications (or any other).

WebsocketEndpoint can be either Stateless or Singleton beans (in EJB world), so I want simply be able to say endpointEJB.notifyClients()...

Thank you

Andy

Am 22.02.2013 um 01:05 schrieb Danny Coward <danny.coward_at_oracle.com>:

> 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
>
>
>
>
>
> --
> Danny Coward
> Java EE
> Oracle Corporation