You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Craig R. McClanahan" <Cr...@eng.sun.com> on 2001/01/24 02:15:07 UTC

Re: Off Topic:: How do detect if user is still using your web application?

Michael Mok wrote:

> Hi
>
> This is a fundamental problem facing all web applications. Due to the
> asynchronous nature of Web pages, it is almost impossible to establish if
> the user is still "using" the application.
>
> In the client/server world. the user session terminates/disconnects when
> they close the application.
>
> How do you implement this for web session? My application creates a new
> session when the users log on, connects them to their database and store
> their database connection handle to their session.
>
> The problem is that I do not know when to terminate their database
> connection. At present, my application terminates their connection when
> their session times out, when they click on the logout button (which usually
> never happens) or when the application gets shutdown.
>
> I would be interested hear how people handles this especially if STRUTS have
> any mechanism to cater for this type of situation.
>

A different approach to this problem would be to use a connection pool rather
than a connection per user.  Besides scaling better (the number of connections
determins only the number of simultaneous requests you can handle, not the
number of logged-in users who might be looking at the previously displayed
page), you don't have to worry about closing database connections until the
application itself is shut down.


>
> TIA
>
> Michael Mok
> www.webappcabaret.com/teatimej

Craig McClanahan