incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r654541 - in /incubator/sling/trunk: api/src/main/java/org/apache/sling/api/request/ commons/testing/src/main/java/org/apache/sling/commons/testing/sling/ sling/core/src/main/java/org/apache/sling/core/impl/debug/ sling/core/src/main/java/o...
Date Thu, 08 May 2008 14:50:30 GMT
Author: bdelacretaz
Date: Thu May  8 07:50:30 2008
New Revision: 654541

URL: http://svn.apache.org/viewvc?rev=654541&view=rev
Log:
SLING-3 - add more useful info to the RequestProgressTracker log

Modified:
    incubator/sling/trunk/api/src/main/java/org/apache/sling/api/request/RequestProgressTracker.java
    incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockRequestProgressTracker.java
    incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/debug/RequestProgressTrackerLogFilter.java
    incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/request/SlingRequestDispatcher.java
    incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/request/SlingRequestProgressTracker.java
    incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/DefaultGetServlet.java

Modified: incubator/sling/trunk/api/src/main/java/org/apache/sling/api/request/RequestProgressTracker.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/request/RequestProgressTracker.java?rev=654541&r1=654540&r2=654541&view=diff
==============================================================================
--- incubator/sling/trunk/api/src/main/java/org/apache/sling/api/request/RequestProgressTracker.java
(original)
+++ incubator/sling/trunk/api/src/main/java/org/apache/sling/api/request/RequestProgressTracker.java
Thu May  8 07:50:30 2008
@@ -118,5 +118,10 @@
      * Dumps the process timer entries to the given writer, one entry per line.
      */
     public void dump(PrintWriter writer);
-
+    
+    /**
+     *  Call this when done processing the request - all calls except the first
+     *  one are ignored 
+     */
+    public void done();
 }

Modified: incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockRequestProgressTracker.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockRequestProgressTracker.java?rev=654541&r1=654540&r2=654541&view=diff
==============================================================================
--- incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockRequestProgressTracker.java
(original)
+++ incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/sling/MockRequestProgressTracker.java
Thu May  8 07:50:30 2008
@@ -48,4 +48,6 @@
     public void startTimer(String timerName) {
     }
 
+    public void done() {
+    }
 }

Modified: incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/debug/RequestProgressTrackerLogFilter.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/debug/RequestProgressTrackerLogFilter.java?rev=654541&r1=654540&r2=654541&view=diff
==============================================================================
--- incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/debug/RequestProgressTrackerLogFilter.java
(original)
+++ incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/debug/RequestProgressTrackerLogFilter.java
Thu May  8 07:50:30 2008
@@ -55,15 +55,19 @@
         
         chain.doFilter(request, response);
         
-        if(log.isDebugEnabled() && request instanceof SlingHttpServletRequest) {
-            int requestId = 0;
-            synchronized (getClass()) {
-                requestId = ++requestCounter;
-            }
+        if(request instanceof SlingHttpServletRequest) {
             final RequestProgressTracker t = ((SlingHttpServletRequest)request).getRequestProgressTracker();
-            final Iterator<String> it = t.getMessages();
-            while(it.hasNext()) {
-                log.debug("REQUEST_{} - " + it.next(), requestId);
+            t.done();
+            
+            if(log.isDebugEnabled()) {
+                int requestId = 0;
+                synchronized (getClass()) {
+                    requestId = ++requestCounter;
+                }
+                final Iterator<String> it = t.getMessages();
+                while(it.hasNext()) {
+                    log.debug("REQUEST_{} - " + it.next(), requestId);
+                }
             }
         }
     }

Modified: incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/request/SlingRequestDispatcher.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/request/SlingRequestDispatcher.java?rev=654541&r1=654540&r2=654541&view=diff
==============================================================================
--- incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/request/SlingRequestDispatcher.java
(original)
+++ incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/request/SlingRequestDispatcher.java
Thu May  8 07:50:30 2008
@@ -118,6 +118,7 @@
             }
         }
 
+        cRequest.getRequestProgressTracker().log("Including resource " + info.getResourcePath());
         rd.getSlingMainServlet().includeContent(request, response, resource,
             info);
     }

Modified: incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/request/SlingRequestProgressTracker.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/request/SlingRequestProgressTracker.java?rev=654541&r1=654540&r2=654541&view=diff
==============================================================================
--- incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/request/SlingRequestProgressTracker.java
(original)
+++ incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/request/SlingRequestProgressTracker.java
Thu May  8 07:50:30 2008
@@ -119,6 +119,8 @@
      * start of the respective timer.
      */
     private final Map<String, Long> namedTimerEntries = new HashMap<String, Long>();
+    
+    private boolean done;
 
     /**
      * Creates a new request progress tracker.
@@ -132,6 +134,8 @@
      * initial timer entry
      */
     public void reset() {
+        done = false;
+        
         // remove all entries
         entries.clear();
         namedTimerEntries.clear();
@@ -241,6 +245,13 @@
                 + "ms");
         }
     }
+    
+    public void done() {
+        if(done) return;
+        logTimer(REQUEST_PROCESSING_TIMER, REQUEST_PROCESSING_TIMER + " ends");
+        done = true;
+    }
+
 
     /** Process tracker entry keeping timestamp, tag and message */
     private static class TrackingEntry {

Modified: incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/DefaultGetServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/DefaultGetServlet.java?rev=654541&r1=654540&r2=654541&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/DefaultGetServlet.java
(original)
+++ incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/DefaultGetServlet.java
Thu May  8 07:50:30 2008
@@ -107,6 +107,9 @@
             return;
         }
 
+        request.getRequestProgressTracker().log("Using " 
+                + rendererServlet.getClass().getName()
+                + " to render for extension=" + ext);
         rendererServlet.service(request, response);
     }
 



Mime
View raw message