]> source.dussan.org Git - vaadin-framework.git/commitdiff
Make sure the request timer is always stopped, better names #8694
authorJonatan Kronqvist <jonatan.kronqvist@itmill.com>
Fri, 27 Apr 2012 08:16:16 +0000 (08:16 +0000)
committerJonatan Kronqvist <jonatan.kronqvist@itmill.com>
Fri, 27 Apr 2012 08:16:16 +0000 (08:16 +0000)
svn changeset:23648/svn branch:6.8

src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java

index de7ad83b54f78bca8023f52cc1137459e1752891..dcf52827ed5aaaad1ec6d3cba479eb0df39a6a93 100644 (file)
@@ -237,7 +237,7 @@ public class ApplicationConnection {
                    ap.@com.vaadin.terminal.gwt.client.ApplicationConnection::lastProcessingTime,
                     ap.@com.vaadin.terminal.gwt.client.ApplicationConnection::totalProcessingTime
                ];
-           pd = pd.concat(ap.@com.vaadin.terminal.gwt.client.ApplicationConnection::testBenchServerStatus);
+           pd = pd.concat(ap.@com.vaadin.terminal.gwt.client.ApplicationConnection::serverTimingInfo);
            return pd;
        });
 
@@ -668,7 +668,7 @@ public class ApplicationConnection {
      * servicing the session so far. These values are always one request behind,
      * since they cannot be measured before the request is finished.
      */
-    private ValueMap testBenchServerStatus;
+    private ValueMap serverTimingInfo;
 
     static final int MAX_CSS_WAITS = 100;
 
@@ -991,10 +991,10 @@ public class ApplicationConnection {
         }
 
         /*
-         * Hook for TestBench to get details about server status
+         * Hook for e.g. TestBench to get details about server peformance
          */
-        if (json.containsKey("tbss")) {
-            testBenchServerStatus = json.getValueMap("tbss");
+        if (json.containsKey("timings")) {
+            serverTimingInfo = json.getValueMap("timings");
         }
 
         Command c = new Command() {
index a9364c3cf7e9219d0e12ef5e21ee1d33cc8245c1..1741ec5e7fe6a0a1010aff385e707427f7f24189 100644 (file)
@@ -488,15 +488,17 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
                                 .endTransaction(application, request);
                     }
                 } finally {
-                    if (requestStarted) {
-                        ((PortletRequestListener) application).onRequestEnd(
-                                request, response);
+                    try {
+                        if (requestStarted) {
+                            ((PortletRequestListener) application)
+                                    .onRequestEnd(request, response);
 
+                        }
+                    } finally {
+                        requestTimer
+                                .stop((AbstractWebApplicationContext) application
+                                        .getContext());
                     }
-
-                    requestTimer
-                            .stop((AbstractWebApplicationContext) application
-                                    .getContext());
                 }
             }
         }
index b177cc5629670582c326d391a4bf0cdfc146825e..d42b2142fe63e373c6a8222aa114c58bc74d76b6 100644 (file)
@@ -546,13 +546,16 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
                 }
 
             } finally {
-                if (requestStarted) {
-                    ((HttpServletRequestListener) application).onRequestEnd(
-                            request, response);
+                try {
+                    if (requestStarted) {
+                        ((HttpServletRequestListener) application)
+                                .onRequestEnd(request, response);
+                    }
+                } finally {
+                    requestTimer
+                            .stop((AbstractWebApplicationContext) application
+                                    .getContext());
                 }
-
-                requestTimer.stop((AbstractWebApplicationContext) application
-                        .getContext());
             }
 
         }
index be1b829eb4b75a6a017b95dd972fe601315f132c..cb570f88e7c1cbae90a01fb12c50641297e8a7d1 100644 (file)
@@ -1206,17 +1206,17 @@ public abstract class AbstractCommunicationManager implements
             dragAndDropService.printJSONResponse(outWriter);
         }
 
-        writePerformanceDataForTestBench(outWriter);
+        writePerformanceData(outWriter);
     }
 
     /**
-     * Adds the performance timing data used by TestBench 3 to the UIDL
+     * Adds the performance timing data (used by TestBench 3) to the UIDL
      * response.
      */
-    private void writePerformanceDataForTestBench(final PrintWriter outWriter) {
+    private void writePerformanceData(final PrintWriter outWriter) {
         AbstractWebApplicationContext ctx = (AbstractWebApplicationContext) application
                 .getContext();
-        outWriter.write(String.format(", \"tbss\":[%d, %d]",
+        outWriter.write(String.format(", \"timings\":[%d, %d]",
                 ctx.getTotalSessionTime(), ctx.getLastRequestTime()));
     }