geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r548000 - in /geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat: GeronimoStandardContext.java listener/RunAsInstanceListener.java
Date Sun, 17 Jun 2007 00:59:35 GMT
Author: djencks
Date: Sat Jun 16 17:59:31 2007
New Revision: 548000

URL: http://svn.apache.org/viewvc?view=rev&rev=548000
Log:
GERONIMO=2687 Make sure tomcat doesn't register or unregister default subjects

Modified:
    geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
    geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/listener/RunAsInstanceListener.java

Modified: geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java?view=diff&rev=548000&r1=547999&r2=548000
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
(original)
+++ geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
Sat Jun 16 17:59:31 2007
@@ -213,15 +213,6 @@
             super.start();
     }
 
-    public synchronized void stop() throws LifecycleException {
-        // Remove the defaultSubject
-        if (defaultSubject != null) {
-            ContextManager.unregisterSubject(defaultSubject);
-        }
-
-        super.stop();
-    }
-
     public void addChild(Container child) {
         Wrapper wrapper = (Wrapper) child;
 

Modified: geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/listener/RunAsInstanceListener.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/listener/RunAsInstanceListener.java?view=diff&rev=548000&r1=547999&r2=548000
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/listener/RunAsInstanceListener.java
(original)
+++ geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/listener/RunAsInstanceListener.java
Sat Jun 16 17:59:31 2007
@@ -16,6 +16,9 @@
  */
 package org.apache.geronimo.tomcat.listener;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import javax.security.auth.Subject;
 
 import org.apache.catalina.Container;
@@ -28,7 +31,11 @@
 
 public class RunAsInstanceListener implements InstanceListener {
 
-    private static final ThreadLocal<Callers> threadLocal = new ThreadLocal<Callers>();
+    private static final ThreadLocal<List<Callers>> threadLocal = new ThreadLocal<List<Callers>>()
{
+        protected List<Callers> initialValue() {
+            return new ArrayList<Callers>(2);
+        }
+    };
     
     public void instanceEvent(InstanceEvent event) {
         
@@ -39,17 +46,19 @@
                 Wrapper wrapper = event.getWrapper();
                 String runAsRole = wrapper.getRunAs();
                 Subject runAsSubject = context.getSubjectForRole(runAsRole);
+                List<Callers> callersStack = threadLocal.get();
                 if (runAsSubject != null) {
-                    Callers oldCallers = ContextManager.getCallers();
-                    ContextManager.registerSubject(runAsSubject);
-                    ContextManager.pushNextCaller(runAsSubject);
-                    threadLocal.set(oldCallers);
+                    Callers oldCallers = ContextManager.pushNextCaller(runAsSubject);
+                    callersStack.add(oldCallers);
+                } else {
+                    callersStack.add(null);
                 }
             }
         }
 
         else if (event.getType().equals(InstanceEvent.AFTER_SERVICE_EVENT)) {
-            Callers oldCallers = threadLocal.get();
+            List<Callers> callersStack = threadLocal.get();
+            Callers oldCallers = callersStack.remove(callersStack.size() - 1);
             if (oldCallers!=null) {
                 ContextManager.popCallers(oldCallers);
             }



Mime
View raw message