geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r475942 - /geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java
Date Thu, 16 Nov 2006 22:05:04 GMT
Author: djencks
Date: Thu Nov 16 14:05:03 2006
New Revision: 475942

URL: http://svn.apache.org/viewvc?view=rev&rev=475942
Log:
GERONIMO-2491 Possible fix for hibernate connection problem, use same context for all connection
tracking through a servlet request include/dispatch

Modified:
    geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java

Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java?view=diff&rev=475942&r1=475941&r2=475942
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java
(original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/handler/InstanceContextHandler.java
Thu Nov 16 14:05:03 2006
@@ -30,7 +30,9 @@
 
 import org.apache.geronimo.connector.outbound.connectiontracking.ConnectorInstanceContext;
 import org.apache.geronimo.connector.outbound.connectiontracking.ConnectorInstanceContextImpl;
+import org.apache.geronimo.connector.outbound.connectiontracking.SharedConnectorInstanceContext;
 import org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator;
+import org.mortbay.jetty.Handler;
 import org.mortbay.jetty.handler.AbstractHandler;
 
 /**
@@ -51,12 +53,24 @@
 
     public void handle(String target, HttpServletRequest request, HttpServletResponse response,
int dispatch) throws IOException, ServletException {
         try {
-            ConnectorInstanceContext oldContext = trackedConnectionAssociator.enter(new ConnectorInstanceContextImpl(unshareableResources,
applicationManagedSecurityResources));
+            if (dispatch == Handler.REQUEST) {
+                ConnectorInstanceContext oldContext = trackedConnectionAssociator.enter(new
SharedConnectorInstanceContext(unshareableResources, applicationManagedSecurityResources,
false));
 
-            try {
-                next.handle(target, request, response, dispatch);
-            } finally {
-                trackedConnectionAssociator.exit(oldContext);
+                try {
+                    next.handle(target, request, response, dispatch);
+                } finally {
+                    trackedConnectionAssociator.exit(oldContext);
+                }
+            } else {
+                SharedConnectorInstanceContext context = new SharedConnectorInstanceContext(unshareableResources,
applicationManagedSecurityResources, true);
+                SharedConnectorInstanceContext oldContext = (SharedConnectorInstanceContext)
trackedConnectionAssociator.enter(context);
+                context.share(oldContext);
+                try {
+                    next.handle(target, request, response, dispatch);
+                } finally {
+                    context.hide();
+                    trackedConnectionAssociator.exit(oldContext);
+                }
             }
         } catch (ResourceException e) {
             throw new ServletException(e);



Mime
View raw message