lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [36/50] [abbrv] lucene-solr:jira/solr-9854: SOLR-9877: Null check for metric registry before attempting to use it
Date Fri, 30 Dec 2016 15:57:12 GMT
SOLR-9877: Null check for metric registry before attempting to use it


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/662be93e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/662be93e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/662be93e

Branch: refs/heads/jira/solr-9854
Commit: 662be93ed11abebaff1d13711f3bffca478ba61e
Parents: 20362de
Author: Shalin Shekhar Mangar <shalin@apache.org>
Authored: Thu Dec 29 09:57:03 2016 +0530
Committer: Shalin Shekhar Mangar <shalin@apache.org>
Committed: Thu Dec 29 09:57:03 2016 +0530

----------------------------------------------------------------------
 .../solr/util/stats/InstrumentedHttpRequestExecutor.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/662be93e/solr/core/src/java/org/apache/solr/util/stats/InstrumentedHttpRequestExecutor.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/util/stats/InstrumentedHttpRequestExecutor.java
b/solr/core/src/java/org/apache/solr/util/stats/InstrumentedHttpRequestExecutor.java
index ad76d73..0426780 100644
--- a/solr/core/src/java/org/apache/solr/util/stats/InstrumentedHttpRequestExecutor.java
+++ b/solr/core/src/java/org/apache/solr/util/stats/InstrumentedHttpRequestExecutor.java
@@ -53,11 +53,16 @@ public class InstrumentedHttpRequestExecutor extends HttpRequestExecutor
impleme
 
   @Override
   public HttpResponse execute(HttpRequest request, HttpClientConnection conn, HttpContext
context) throws IOException, HttpException {
-    final Timer.Context timerContext = timer(request).time();
+    Timer.Context timerContext = null;
+    if (metricsRegistry != null)  {
+      timerContext = timer(request).time();
+    }
     try {
       return super.execute(request, conn, context);
     } finally {
-      timerContext.stop();
+      if (timerContext != null) {
+        timerContext.stop();
+      }
     }
   }
 


Mime
View raw message