Author: markt
Date: Fri Jun 5 21:38:44 2009
New Revision: 782145
URL: http://svn.apache.org/viewvc?rev=782145&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=47299
Simplify fireContainerEvent method and enable it to work with implementations
that extend StandardContext.
See http://svn.apache.org/viewvc?view=rev&revision=287710 for why it was
written this way originally.
Modified:
tomcat/trunk/java/org/apache/catalina/session/StandardSession.java
Modified: tomcat/trunk/java/org/apache/catalina/session/StandardSession.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardSession.java?rev=782145&r1=782144&r2=782145&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/StandardSession.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/session/StandardSession.java Fri Jun
5 21:38:44 2009
@@ -25,7 +25,6 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
-import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.Principal;
import java.security.PrivilegedAction;
@@ -57,6 +56,7 @@
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.StringManager;
+import org.apache.catalina.core.StandardContext;
import org.apache.catalina.security.SecurityUtil;
/**
@@ -142,24 +142,6 @@
/**
- * The <code>java.lang.Method</code> for the
- * <code>fireContainerEvent()</code> method of the
- * <code>org.apache.catalina.core.StandardContext</code> method,
- * if our Context implementation is of this class. This value is
- * computed dynamically the first time it is needed, or after
- * a session reload (since it is declared transient).
- */
- protected transient Method containerEventMethod = null;
-
-
- /**
- * The method signature for the <code>fireContainerEvent</code> method.
- */
- protected static final Class<?> containerEventTypes[] =
- { String.class, Object.class };
-
-
- /**
* The time this session was created, in milliseconds since midnight,
* January 1, 1970 GMT.
*/
@@ -1594,21 +1576,10 @@
String type, Object data)
throws Exception {
- if (!"org.apache.catalina.core.StandardContext".equals
- (context.getClass().getName())) {
- return; // Container events are not supported
- }
- // NOTE: Race condition is harmless, so do not synchronize
- if (containerEventMethod == null) {
- containerEventMethod =
- context.getClass().getMethod("fireContainerEvent",
- containerEventTypes);
- }
- Object containerEventParams[] = new Object[2];
- containerEventParams[0] = type;
- containerEventParams[1] = data;
- containerEventMethod.invoke(context, containerEventParams);
-
+ if (context instanceof StandardContext) {
+ // NOTE: Race condition is harmless, so do not synchronize
+ ((StandardContext) context).fireContainerEvent(type, data);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]