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

[2/2] lucene-solr:branch_6x: SOLR-9877: Null check for metric registry before attempting to use it

SOLR-9877: Null check for metric registry before attempting to use it

(cherry picked from commit 662be93)


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

Branch: refs/heads/branch_6x
Commit: f65dc06180bdb02cfbfa048e2f08d1183c250d5d
Parents: a50ebcb
Author: Shalin Shekhar Mangar <sh...@apache.org>
Authored: Thu Dec 29 09:57:03 2016 +0530
Committer: Shalin Shekhar Mangar <sh...@apache.org>
Committed: Wed Jan 4 11:06:06 2017 +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/f65dc061/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();
+      }
     }
   }