From 22607d19be5f748bfd52bc6d260638c5e1eba6d3 Mon Sep 17 00:00:00 2001 From: Bingkun Guo Date: Mon, 8 Jun 2015 09:01:45 -0500 Subject: [PATCH] Make AbstractHttpClientProvider contents lazily instantiated --- .../guice/http/AbstractHttpClientProvider.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/server/src/main/java/io/druid/guice/http/AbstractHttpClientProvider.java b/server/src/main/java/io/druid/guice/http/AbstractHttpClientProvider.java index d61840935ac..7f83898e90c 100644 --- a/server/src/main/java/io/druid/guice/http/AbstractHttpClientProvider.java +++ b/server/src/main/java/io/druid/guice/http/AbstractHttpClientProvider.java @@ -36,9 +36,7 @@ public abstract class AbstractHttpClientProvider implements Prov private final Key> configKey; private final Key sslContextKey; - private Provider> configProvider; - private Provider lifecycleProvider; - private Binding sslContextBinding; + private Injector injector; public AbstractHttpClientProvider() { @@ -73,9 +71,7 @@ public abstract class AbstractHttpClientProvider implements Prov @Inject public void configure(Injector injector) { - configProvider = injector.getProvider(configKey); - sslContextBinding = injector.getExistingBinding(sslContextKey); - lifecycleProvider = injector.getProvider(Lifecycle.class); + this.injector = injector; } public Key> getConfigKey() @@ -90,16 +86,16 @@ public abstract class AbstractHttpClientProvider implements Prov public Provider> getConfigProvider() { - return configProvider; + return injector.getProvider(configKey); } public Provider getLifecycleProvider() { - return lifecycleProvider; + return injector.getProvider(Lifecycle.class); } public Binding getSslContextBinding() { - return sslContextBinding; + return injector.getExistingBinding(sslContextKey); } }