Package org.apache.solr.util.stats
Class InstrumentedPoolingHttpClientConnectionManager
- java.lang.Object
-
- org.apache.http.impl.conn.PoolingHttpClientConnectionManager
-
- org.apache.solr.util.stats.InstrumentedPoolingHttpClientConnectionManager
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.http.conn.HttpClientConnectionManager
,org.apache.http.pool.ConnPoolControl<org.apache.http.conn.routing.HttpRoute>
,SolrMetricProducer
public class InstrumentedPoolingHttpClientConnectionManager extends org.apache.http.impl.conn.PoolingHttpClientConnectionManager implements SolrMetricProducer
Sub-class of PoolingHttpClientConnectionManager which tracks metrics interesting to Solr. Inspired by dropwizard metrics-httpclient library implementation.
-
-
Constructor Summary
Constructors Constructor Description InstrumentedPoolingHttpClientConnectionManager(org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> socketFactoryRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Implementations should always callSolrMetricProducer.super.close()
to ensure that metrics with the same life-cycle as this component are properly unregistered.SolrMetricsContext
getSolrMetricsContext()
Implementations should return the context used inSolrMetricProducer.initializeMetrics(SolrMetricsContext, String)
to ensure proper cleanup of metrics at the end of the life-cycle of this component.void
initializeMetrics(SolrMetricsContext parentContext, String scope)
Initialize metrics specific to this producer.-
Methods inherited from class org.apache.http.impl.conn.PoolingHttpClientConnectionManager
closeExpiredConnections, closeIdleConnections, connect, enumAvailable, enumLeased, finalize, getConnectionConfig, getDefaultConnectionConfig, getDefaultMaxPerRoute, getDefaultSocketConfig, getMaxPerRoute, getMaxTotal, getRoutes, getSocketConfig, getStats, getTotalStats, getValidateAfterInactivity, leaseConnection, releaseConnection, requestConnection, routeComplete, setConnectionConfig, setDefaultConnectionConfig, setDefaultMaxPerRoute, setDefaultSocketConfig, setMaxPerRoute, setMaxTotal, setSocketConfig, setValidateAfterInactivity, shutdown, upgrade
-
-
-
-
Method Detail
-
getSolrMetricsContext
public SolrMetricsContext getSolrMetricsContext()
Description copied from interface:SolrMetricProducer
Implementations should return the context used inSolrMetricProducer.initializeMetrics(SolrMetricsContext, String)
to ensure proper cleanup of metrics at the end of the life-cycle of this component. This should be the child context if one was created, or null if the parent context was used.- Specified by:
getSolrMetricsContext
in interfaceSolrMetricProducer
-
initializeMetrics
public void initializeMetrics(SolrMetricsContext parentContext, String scope)
Description copied from interface:SolrMetricProducer
Initialize metrics specific to this producer.- Specified by:
initializeMetrics
in interfaceSolrMetricProducer
- Parameters:
parentContext
- parent metrics context. If this component has the same life-cycle as the parent it can simply use the parent context, otherwise it should obtain a child context usingSolrMetricsContext.getChildContext(Object)
passingthis
as the child object.scope
- component scope
-
close
public void close()
Description copied from interface:SolrMetricProducer
Implementations should always callSolrMetricProducer.super.close()
to ensure that metrics with the same life-cycle as this component are properly unregistered. This prevents obscure memory leaks.from: https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html While this interface method is declared to throw Exception, implementers are strongly encouraged to declare concrete implementations of the close method to throw more specific exceptions, or to throw no exception at all if the close operation cannot fail.
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceSolrMetricProducer
- Overrides:
close
in classorg.apache.http.impl.conn.PoolingHttpClientConnectionManager
-
-