sigram commented on a change in pull request #825: SOLR-13677 All Metrics 
Gauges should be unregistered by the objects that registered them
URL: https://github.com/apache/lucene-solr/pull/825#discussion_r312872053
 
 

 ##########
 File path: solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java
 ##########
 @@ -319,6 +325,11 @@ public PluginInfo getPluginInfo(){
     return  pluginInfo;
   }
 
+  @Override
+  public void close()  {
+    if (metricsInfo != null) metricsInfo.unregister();
 
 Review comment:
   Again, this is also a repeating pattern that is easy to forget (in fact you 
forgot about this in one place even in this patch). If it's something that has 
to be done reliably then I think the framework should take care of that.
   
   See for example how `SolrInfoBean.registerMetricName()` is designed - it 
uses result of another method to determine whether it's a no-op. Similarly, we 
could add `SolrMetricProducer.getMetricsInfo()` in addition to `AutoCloseable` 
and then always call `unregister` in `default void close()`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to