usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [2/3] incubator-usergrid git commit: Remove redundant timer.close() calls. Also, change behavior of GraphiteReporter: during tests, it uses a higher frequency for polling.
Date Wed, 22 Apr 2015 20:05:21 GMT
Remove redundant timer.close() calls. Also, change behavior of GraphiteReporter: during tests,
it uses a higher frequency for polling.


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/77819b34
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/77819b34
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/77819b34

Branch: refs/heads/master
Commit: 77819b343dc18f74068d29a3613753549dbb2ab4
Parents: 4e42353
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Wed Apr 22 15:12:18 2015 -0400
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Wed Apr 22 15:12:18 2015 -0400

----------------------------------------------------------------------
 .../java/org/apache/usergrid/metrics/MetricsFactory.java | 11 +++++++++--
 .../usergrid/rest/management/ManagementResource.java     |  2 --
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/77819b34/stack/core/src/main/java/org/apache/usergrid/metrics/MetricsFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/metrics/MetricsFactory.java b/stack/core/src/main/java/org/apache/usergrid/metrics/MetricsFactory.java
index 9b98799..db836e5 100644
--- a/stack/core/src/main/java/org/apache/usergrid/metrics/MetricsFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/metrics/MetricsFactory.java
@@ -61,8 +61,15 @@ public class MetricsFactory {
                 .filter( MetricFilter.ALL )
                 .build( graphite );
 
-        if (metricsHost != badHost) {
-            graphiteReporter.start( 30, TimeUnit.SECONDS );
+        if ( !metricsHost.equalsIgnoreCase( badHost )) {
+
+            if ( "true".equalsIgnoreCase( properties.getProperty( "usergrid.test" ) ) ) {
+                // run at higher frequency for testing, we can't wait 30 seconds to start
+                graphiteReporter.start( 200, TimeUnit.MILLISECONDS );
+
+            } else {
+                graphiteReporter.start( 30, TimeUnit.SECONDS );
+            }
             LOG.info("MetricsService: Reporter started.");
         } else {
             LOG.warn( "MetricsService: Reporter not started." );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/77819b34/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
b/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
index 2e5f5e4..0e1469c 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
@@ -640,7 +640,6 @@ public class ManagementResource extends AbstractContextResource {
 
         } catch (Exception e) {
             timerContext.stop();
-            timerContext.close();
             logger.debug("Error validating external token", e);
             throw e;
         }
@@ -648,7 +647,6 @@ public class ManagementResource extends AbstractContextResource {
         final Response response = Response.status( SC_OK ).type( jsonMediaType( callback
) ).entity( accessInfo ).build();
 
         timerContext.stop();
-        timerContext.close();
 
         return response;
     }


Mime
View raw message