You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2003/02/10 10:59:01 UTC
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java
remm 2003/02/10 01:59:01
Modified: catalina/src/share/org/apache/catalina/session
StandardSession.java
Log:
- Experiment: add some syncing in Session.expire.
Revision Changes Path
1.12 +58 -49 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java
Index: StandardSession.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- StandardSession.java 11 Jan 2003 02:50:06 -0000 1.11
+++ StandardSession.java 10 Feb 2003 09:59:01 -0000 1.12
@@ -624,65 +624,74 @@
* this session?
*/
public void expire(boolean notify) {
+
// Mark this session as "being expired" if needed
if (expiring)
return;
- expiring = true;
+
+ synchronized (this) {
+
+ if (manager == null)
+ return;
+
+ expiring = true;
- // Notify interested application event listeners
- // FIXME - Assumes we call listeners in reverse order
- Context context = (Context) manager.getContainer();
- Object listeners[] = context.getApplicationListeners();
- if (notify && (listeners != null)) {
- HttpSessionEvent event =
- new HttpSessionEvent(getSession());
- for (int i = 0; i < listeners.length; i++) {
- int j = (listeners.length - 1) - i;
- if (!(listeners[j] instanceof HttpSessionListener))
- continue;
- HttpSessionListener listener =
- (HttpSessionListener) listeners[j];
- try {
- fireContainerEvent(context,
- "beforeSessionDestroyed",
- listener);
- listener.sessionDestroyed(event);
- fireContainerEvent(context,
- "afterSessionDestroyed",
- listener);
- } catch (Throwable t) {
+ // Notify interested application event listeners
+ // FIXME - Assumes we call listeners in reverse order
+ Context context = (Context) manager.getContainer();
+ Object listeners[] = context.getApplicationListeners();
+ if (notify && (listeners != null)) {
+ HttpSessionEvent event =
+ new HttpSessionEvent(getSession());
+ for (int i = 0; i < listeners.length; i++) {
+ int j = (listeners.length - 1) - i;
+ if (!(listeners[j] instanceof HttpSessionListener))
+ continue;
+ HttpSessionListener listener =
+ (HttpSessionListener) listeners[j];
try {
fireContainerEvent(context,
+ "beforeSessionDestroyed",
+ listener);
+ listener.sessionDestroyed(event);
+ fireContainerEvent(context,
"afterSessionDestroyed",
listener);
- } catch (Exception e) {
- ;
+ } catch (Throwable t) {
+ try {
+ fireContainerEvent(context,
+ "afterSessionDestroyed",
+ listener);
+ } catch (Exception e) {
+ ;
+ }
+ // FIXME - should we do anything besides log these?
+ log(sm.getString("standardSession.sessionEvent"), t);
}
- // FIXME - should we do anything besides log these?
- log(sm.getString("standardSession.sessionEvent"), t);
}
}
- }
- setValid(false);
+ setValid(false);
+
+ // Remove this session from our manager's active sessions
+ if (manager != null)
+ manager.remove(this);
+
+ // Unbind any objects associated with this session
+ String keys[] = keys();
+ for (int i = 0; i < keys.length; i++)
+ removeAttribute(keys[i], notify);
+
+ // Notify interested session event listeners
+ if (notify) {
+ fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
+ }
+
+ // We have completed expire of this session
+ expiring = false;
+ if ((manager != null) && (manager instanceof ManagerBase)) {
+ recycle();
+ }
- // Remove this session from our manager's active sessions
- if (manager != null)
- manager.remove(this);
-
- // Unbind any objects associated with this session
- String keys[] = keys();
- for (int i = 0; i < keys.length; i++)
- removeAttribute(keys[i], notify);
-
- // Notify interested session event listeners
- if (notify) {
- fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
- }
-
- // We have completed expire of this session
- expiring = false;
- if ((manager != null) && (manager instanceof ManagerBase)) {
- recycle();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org