mirror of https://github.com/apache/lucene.git
SOLR-9877: Null check for metric registry before attempting to use it
This commit is contained in:
parent
20362deb7e
commit
662be93ed1
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue