mirror of https://github.com/apache/druid.git
Make AbstractHttpClientProvider contents lazily instantiated
This commit is contained in:
parent
52f261eea7
commit
22607d19be
|
@ -36,9 +36,7 @@ public abstract class AbstractHttpClientProvider<HttpClientType> implements Prov
|
||||||
private final Key<Supplier<DruidHttpClientConfig>> configKey;
|
private final Key<Supplier<DruidHttpClientConfig>> configKey;
|
||||||
private final Key<SSLContext> sslContextKey;
|
private final Key<SSLContext> sslContextKey;
|
||||||
|
|
||||||
private Provider<Supplier<DruidHttpClientConfig>> configProvider;
|
private Injector injector;
|
||||||
private Provider<Lifecycle> lifecycleProvider;
|
|
||||||
private Binding<SSLContext> sslContextBinding;
|
|
||||||
|
|
||||||
public AbstractHttpClientProvider()
|
public AbstractHttpClientProvider()
|
||||||
{
|
{
|
||||||
|
@ -73,9 +71,7 @@ public abstract class AbstractHttpClientProvider<HttpClientType> implements Prov
|
||||||
@Inject
|
@Inject
|
||||||
public void configure(Injector injector)
|
public void configure(Injector injector)
|
||||||
{
|
{
|
||||||
configProvider = injector.getProvider(configKey);
|
this.injector = injector;
|
||||||
sslContextBinding = injector.getExistingBinding(sslContextKey);
|
|
||||||
lifecycleProvider = injector.getProvider(Lifecycle.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Key<Supplier<DruidHttpClientConfig>> getConfigKey()
|
public Key<Supplier<DruidHttpClientConfig>> getConfigKey()
|
||||||
|
@ -90,16 +86,16 @@ public abstract class AbstractHttpClientProvider<HttpClientType> implements Prov
|
||||||
|
|
||||||
public Provider<Supplier<DruidHttpClientConfig>> getConfigProvider()
|
public Provider<Supplier<DruidHttpClientConfig>> getConfigProvider()
|
||||||
{
|
{
|
||||||
return configProvider;
|
return injector.getProvider(configKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Provider<Lifecycle> getLifecycleProvider()
|
public Provider<Lifecycle> getLifecycleProvider()
|
||||||
{
|
{
|
||||||
return lifecycleProvider;
|
return injector.getProvider(Lifecycle.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Binding<SSLContext> getSslContextBinding()
|
public Binding<SSLContext> getSslContextBinding()
|
||||||
{
|
{
|
||||||
return sslContextBinding;
|
return injector.getExistingBinding(sslContextKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue