jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1182469 - /jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/jackrabbit/StatisticsServlet.java
Date Wed, 12 Oct 2011 16:41:08 GMT
Author: jukka
Date: Wed Oct 12 16:41:07 2011
New Revision: 1182469

URL: http://svn.apache.org/viewvc?rev=1182469&view=rev
Log:
JCR-3040 JMX Stats for the Session

Adjust StatisticsServlet to match the previous commit

Modified:
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/jackrabbit/StatisticsServlet.java

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/jackrabbit/StatisticsServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/jackrabbit/StatisticsServlet.java?rev=1182469&r1=1182468&r2=1182469&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/jackrabbit/StatisticsServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/jackrabbit/StatisticsServlet.java
Wed Oct 12 16:41:07 2011
@@ -25,9 +25,9 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.jackrabbit.api.stats.RepositoryStatistics;
+import org.apache.jackrabbit.api.stats.TimeSeries;
 import org.apache.jackrabbit.core.RepositoryContext;
-import org.apache.jackrabbit.core.stats.RepositoryStatistics;
-import org.apache.jackrabbit.core.stats.TimeSeries;
 
 /**
  * Servlet that makes Jackrabbit repository statistics available as
@@ -57,15 +57,14 @@ public class StatisticsServlet extends H
             response.setContentType("application/json");
             Writer writer = response.getWriter();
             writer.write('{');
-            boolean first = true;
-            for (Map.Entry<String, TimeSeries> entry : statistics) {
-                if (first) {
-                    first = false;
-                } else {
-                    writer.write(',');
-                }
-                write(writer, entry.getKey(), entry.getValue());
-            }
+            write(writer, "read", statistics.getTimeSeries(
+                    RepositoryStatistics.Type.SESSION_READ_COUNTER));
+            writer.write(',');
+            write(writer, "write", statistics.getTimeSeries(
+                    RepositoryStatistics.Type.SESSION_WRITE_COUNTER));
+            writer.write(',');
+            write(writer, "login", statistics.getTimeSeries(
+                    RepositoryStatistics.Type.SESSION_LOGIN_COUNTER));
             writer.write('}');
         } else {
             response.sendError(
@@ -81,13 +80,13 @@ public class StatisticsServlet extends H
         writer.write('"');
         writer.write(':');
         writer.write('{');
-        write(writer, "second", series.getEventsPerSecond());
+        write(writer, "second", series.getValuePerSecond());
         writer.write(',');
-        write(writer, "minute", series.getEventsPerMinute());
+        write(writer, "minute", series.getValuePerMinute());
         writer.write(',');
-        write(writer, "hour", series.getEventsPerHour());
+        write(writer, "hour", series.getValuePerHour());
         writer.write(',');
-        write(writer, "week", series.getEventsPerWeek());
+        write(writer, "week", series.getValuePerWeek());
         writer.write('}');
     }
 



Mime
View raw message