You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kr...@apache.org on 2017/01/03 18:48:18 UTC

[07/50] lucene-solr:jira/solr-8593: SOLR-9877: Null check for metric registry before attempting to use it

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-8593
Commit: 662be93ed11abebaff1d13711f3bffca478ba61e
Parents: 20362de
Author: Shalin Shekhar Mangar <sh...@apache.org>
Authored: Thu Dec 29 09:57:03 2016 +0530
Committer: Shalin Shekhar Mangar <sh...@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();
+      }
     }
   }