Forward port from 5.5, expose what thread is currently executing a request to JMX
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 8 Apr 2007 17:02:12 +0000 (17:02 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 8 Apr 2007 17:02:12 +0000 (17:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@526576 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/connector/CoyoteAdapter.java
java/org/apache/coyote/RequestInfo.java

index 9a7dd70..a07a087 100644 (file)
@@ -151,6 +151,8 @@ public class CoyoteAdapter
                         request.getEvent().setEventSubType(CometEvent.EventSubType.TIMEOUT);
                     }
                 }
+
+                req.getRequestProcessor().setWorkerThreadName(Thread.currentThread().getName());
                 
                 // Calling the container
                 connector.getContainer().getPipeline().getFirst().event(request, response, request.getEvent());
@@ -176,6 +178,7 @@ public class CoyoteAdapter
                 // a cleanup event of some sort could be needed ?
                 return false;
             } finally {
+                req.getRequestProcessor().setWorkerThreadName(null);
                 // Recycle the wrapper request and response
                 if (error || response.isClosed() || !request.isComet()) {
                     request.recycle();
@@ -232,8 +235,8 @@ public class CoyoteAdapter
 
             // Parse and set Catalina and configuration specific 
             // request parameters
+            req.getRequestProcessor().setWorkerThreadName(Thread.currentThread().getName());
             if (postParseRequest(req, request, res, response)) {
-
                 // Calling the container
                 connector.getContainer().getPipeline().getFirst().invoke(request, response);
 
@@ -260,6 +263,7 @@ public class CoyoteAdapter
         } catch (Throwable t) {
             log.error(sm.getString("coyoteAdapter.service"), t);
         } finally {
+            req.getRequestProcessor().setWorkerThreadName(null);
             // Recycle the wrapper request and response
             if (!comet) {
                 request.recycle();
index 94cbf51..25956d9 100644 (file)
@@ -62,6 +62,7 @@ public class RequestInfo  {
     Request req;
     Response res;
     int stage = Constants.STAGE_NEW;
+    String workerThreadName;
 
     // -------------------- Information about the current request  -----------
     // This is usefull for long-running requests only
@@ -212,5 +213,11 @@ public class RequestInfo  {
         this.errorCount = errorCount;
     }
 
+    public String getWorkerThreadName() {
+        return workerThreadName;
+    }
 
+    public void setWorkerThreadName(String workerThreadName) {
+        this.workerThreadName = workerThreadName;
+    }
 }