tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Petruzella, Jim" <Jim.Petruze...@perdue.com>
Subject RE: sessionListener.sessionDestroyed is called on shutdown of a node in the cluster
Date Thu, 17 Apr 2008 13:51:16 GMT
Please remove me from this list...

Thanks!!

Jim Petruzella
Windows System Administrator
Distributed Systems
Perdue Farms Inc.
Corporate Office
Salisbury  Md. 21802
www.perdue.com
jim.petruzella@perdue.com
(410) 341-2176

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Thursday, April 17, 2008 9:50 AM
To: Tomcat Users List
Cc: Filip Hanik - Dev Lists
Subject: Re: sessionListener.sessionDestroyed is called on shutdown of a node in the cluster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ronald,

Ronald Klop wrote:
| In sessionDestroyed I register the user as logged out.
|
| How can I know if sessionDestroyed is called from session.invalidate()
| from the real expiration of the session or shutdown of one cluster node?

Are your shutdowns typically planned? If so, you could stick something
in the session like "shuttingDown192.168.1.123" and then check for that
key when you are processing a "session destroyed" event. Just ignore
such events from the current machine's IP address.

Or, you could even do something like this:

1. Before shutdown, place a "shutting down" key in the application scope.

2. Modify your sessionDestroyed code to do this:

public void sessionDestroyed(HttpSessionEvent se)
{
~  ServletContext application = se.getSession().getServletContext();

~  if(null != application.getAttribute("SHUTTING_DOWN"))
~      return;

~  // Otherwise, process the shutdown normally.
}

This should work given that the application scope is not distributed
across nodes in the cluster. You just put your node in a "shutdown"
state and then ignore all events (or any you care to ignore).

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgHVX0ACgkQ9CaO5/Lv0PC27ACfdh2El6QLeI4LpHaoowJcfJ/Q
cOgAn1ocNzI8qXhax4cs/LLUJYSqWytT
=7EAa
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




DISCLAIMER:
**********************************************************************
This communication, including attachments, may contain confidential, privileged, copyrighted
or other legally protected information.  If you are not the intended recipient, you are hereby
notified that any use, disclosure, dissemination, distribution, or copying of this communication,
or any of its contents, is strictly prohibited.  If you have received this communication in
error, please immediately re-send this communication to the sender and delete the original
message and any copy of it, including all attachments, from your computer system.
**********************************************************************


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message