geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r601864 - in /geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat: GeronimoStandardContext.java TomcatContainer.java
Date Thu, 06 Dec 2007 21:38:04 GMT
Author: gawor
Date: Thu Dec  6 13:38:04 2007
New Revision: 601864

URL: http://svn.apache.org/viewvc?rev=601864&view=rev
Log:
expose jndi in session listener (the listener is called from a background thread). also clean
up some other jndi code. (GERONIMO-3528)

Modified:
    geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
    geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java

Modified: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java?rev=601864&r1=601863&r2=601864&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
(original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
Thu Dec  6 13:38:04 2007
@@ -191,6 +191,44 @@
         }
     }
 
+    /* This method is called by a background thread to destroy sessions (among other things)
+     * so we need to apply appropriate context to the thread to expose JNDI, etc.
+     */
+    public void backgroundProcess() {
+        Object context[] = null;
+        
+        if (beforeAfter != null){
+            context = new Object[contextCount];
+            beforeAfter.before(context, null, null, BeforeAfter.EDGE_SERVLET);
+        }
+        
+        try {
+            super.backgroundProcess();
+        } finally {
+            if (beforeAfter != null){
+                beforeAfter.after(context, null, null, 0);
+            }
+        }
+    }
+    
+    public void kill() throws Exception {
+        Object context[] = null;
+        
+        if (beforeAfter != null){
+            context = new Object[contextCount];
+            beforeAfter.before(context, null, null, BeforeAfter.EDGE_SERVLET);
+        }
+        
+        try {
+            stop();
+            destroy();
+        } finally {
+            if (beforeAfter != null){
+                beforeAfter.after(context, null, null, 0);
+            }
+        }
+    }
+
     public synchronized void start() throws LifecycleException {
         if (pipelineInitialized) {
             try {

Modified: geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=601864&r1=601863&r2=601864&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
(original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
Thu Dec  6 13:38:04 2007
@@ -20,7 +20,6 @@
 import java.net.URL;
 import java.net.URLStreamHandlerFactory;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 import javax.management.ObjectName;
@@ -31,7 +30,6 @@
 import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.Realm;
 import org.apache.catalina.connector.Connector;
-import org.apache.catalina.core.StandardEngine;
 import org.apache.catalina.realm.JAASRealm;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -41,7 +39,6 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.management.geronimo.NetworkConnector;
 import org.apache.geronimo.management.geronimo.WebManager;
-import org.apache.geronimo.naming.java.RootContext;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.tomcat.realm.TomcatGeronimoRealm;
 import org.apache.geronimo.tomcat.realm.TomcatJAASRealm;
@@ -369,15 +366,10 @@
             if (context instanceof GeronimoStandardContext) {
                 GeronimoStandardContext stdctx = (GeronimoStandardContext) context;
 
-                javax.naming.Context oldContext = RootContext.getComponentContext();
-                RootContext.setComponentContext(ctx.getJndiContext());
                 try {
-                    stdctx.stop();
-                    stdctx.destroy();
+                    stdctx.kill();
                 } catch (Exception e) {
                     throw new RuntimeException(e);
-                } finally {
-                    RootContext.setComponentContext(oldContext);
                 }
 
             }



Mime
View raw message