yes. it will not be transported to the client. but active sessions are
'swapped' to disk (or db) if the appserver terminates with active
connections (and restored if the appserver comes up again).
also in a clustered-environment the sessions are replicated to
other server (via serializiation).
klaus
> But the mentioned session-listener: I dont know anything about it. Where
simple. i've copied some code.
> can I get information? How to install? Can I access the objects of a
> destroyed session, or will this happen before the session is destroyed?
i don't know. but it's simple to try it out.
---snipp---
public class MySessionListener implements javax.servlet.http.HttpSessionListener {
static java.util.Hashtable ht = new java.util.Hashtable();
public void sessionDestroyed( javax.servlet.http.HttpSessionEvent se ) {
HttpSession hs = se.getSession();
String id = hs.getId();
System.out.println( "------------------> session " + id + " destroyed
<----------------" );
System.gc();
try {
ht.remove(id);
} catch(Exception e) {/*ignored*/}
---cleanup_coding---
}
public void sessionCreated( javax.servlet.http.HttpSessionEvent se ) {
HttpSession hs = se.getSession();
String id = hs.getId();
System.out.println( "------------------> session " + id + " created
<----------------" );
try {
ht.put(id, hs);
} catch(Exception e) {/*ignored*/}
}
public static java.util.Collection getActiveUserSessions() {
return ht.values();
}
public static HttpSession getSession(String s) {
return (HttpSession)ht.get(s);
}
}
web.xml (use 2.3 header!):
<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'
'http://java.sun.com/j2ee/dtds/web-app_2.3.dtd'>
<listener>
<listener-class>MySessionListener</listener-class>
</listener>
---snipp---
m Mittwoch, 15. Januar 2003 11:24 schrieb [EMAIL PROTECTED]:
> Hi Klaus,
>
> I'm not sure, but the connection has to be serializable? The only thing
> delivered to the client is the ID. I think all the objects inside the
> session stay on my server. Isnt that right?
>
> But the mentioned session-listener: I dont know anything about it. Where
> can I get information? How to install? Can I access the objects of a
> destroyed session, or will this happen before the session is destroyed?
>
> thanks in advance Seppo
>
> -----Urspr�ngliche Nachricht-----
> Von: Klaus Thiele [mailto:[EMAIL PROTECTED]]
> Gesendet: Mittwoch, 15. Januar 2003 11:18
> An: [EMAIL PROTECTED]
> Betreff: Re: Adapt the SimpleSessionHandler
>
>
> Hi Sebastian,
>
> what's about a HttpSessionListener? you can track new sessionrequests and
> get an event if the session was destroyed or timeouts.
>
> but, imho, i think it's not a goot idea to store the db-connection into the
> session because it is not serializable and some not-friendly app-servers
> will be worry about this.
>
> klaus
>
>
> Am Mittwoch, 15. Januar 2003 11:09 schrieb
>
> [EMAIL PROTECTED]:
> > Hi list,
> >
> > I have a small problem with that SimpleSessionHandler. I put my
> > database-connection to the session. If the user terminates the process
> > I can destroy the connection, but if the session got timed out, the
> > session is active and active and active... For about 10 or 15 minutes.
> > I think afterwards the connection is closed by the database. Now I'm
> > thinking about what I could do to let the connection be destroyed,
> > when the session is inactivated. I looked into the sourcecode of
> > SimpleSessionHandler and I know what happens inside there. What would
> > be a good chance for me? To get into the loop where the victims (timed
> > out
> > sessions) are destroyed/removeed from the sessions-list? That could work,
> > but I'm scared of playing around in that code.
> > Does anybody have a better idea how to force the SessionHandler to
> > destroy all accesses to all objects inside the session?
> >
> > help is as always appreciated!
> >
> > Greetings from Hamburg/Germany
> > Seppo
> >
> > Sebastian Beyer
> > Softwareengineer
> > Wettschereck & Partner
> > Gesellschaft f�r Informationstechnologie mbH
> > Ziethenstra�e 14A
> > 22041 Hamburg
> > Tel. +49-40-689468-0
> > Fax. +49-40-689468-99
--
--
Klaus Thiele - Personal & Informatik AG
mailto:[EMAIL PROTECTED]
"There's got to be more to life than compile-and-go."