Merge pull request #1425 from guobingkun/guice_fix

Anyways, @guobingkun , if possible,  can you please test proposed change and send another PR to fix #1016 .  but that doesn't necessarily hold this PR, so I'm merging this.
This commit is contained in:
Himanshu 2015-06-04 14:43:26 -05:00
commit f81a0d9210
1 changed files with 15 additions and 7 deletions

View File

@ -28,13 +28,12 @@ import com.google.inject.Key;
import com.google.inject.Module;
import com.google.inject.util.Modules;
import com.metamx.common.ISE;
import com.metamx.common.logger.Logger;
import com.metamx.common.StringUtils;
import com.metamx.common.logger.Logger;
import io.druid.curator.CuratorModule;
import io.druid.curator.discovery.DiscoveryModule;
import io.druid.guice.AWSModule;
import io.druid.guice.AnnouncerModule;
import io.druid.metadata.storage.derby.DerbyMetadataStorageDruidModule;
import io.druid.guice.DruidProcessingModule;
import io.druid.guice.DruidSecondaryModule;
import io.druid.guice.ExtensionsConfig;
@ -54,6 +53,7 @@ import io.druid.guice.annotations.Client;
import io.druid.guice.annotations.Json;
import io.druid.guice.annotations.Smile;
import io.druid.guice.http.HttpClientModule;
import io.druid.metadata.storage.derby.DerbyMetadataStorageDruidModule;
import io.druid.server.initialization.EmitterModule;
import io.druid.server.initialization.jetty.JettyServerModule;
import io.druid.server.metrics.MetricsModule;
@ -158,7 +158,11 @@ public class Initialization
return retVal;
}
public static URLClassLoader getClassLoaderForCoordinates(TeslaAether aether, String coordinate, String defaultVersion)
public static URLClassLoader getClassLoaderForCoordinates(
TeslaAether aether,
String coordinate,
String defaultVersion
)
throws DependencyResolutionException, MalformedURLException
{
URLClassLoader loader = loadersMap.get(coordinate);
@ -310,7 +314,8 @@ public class Initialization
}
}
, false, StringUtils.UTF8_STRING)
, false, StringUtils.UTF8_STRING
)
);
return new DefaultTeslaAether(
config.getLocalRepository(),
@ -361,12 +366,15 @@ public class Initialization
actualModules.addModule(module);
}
Module intermediateModules = Modules.override(defaultModules.getModules()).with(actualModules.getModules());
ModuleList extensionModules = new ModuleList(baseInjector);
final ExtensionsConfig config = baseInjector.getInstance(ExtensionsConfig.class);
for (DruidModule module : Initialization.getFromExtensions(config, DruidModule.class)) {
actualModules.addModule(module);
extensionModules.addModule(module);
}
return Guice.createInjector(Modules.override(defaultModules.getModules()).with(actualModules.getModules()));
return Guice.createInjector(Modules.override(intermediateModules).with(extensionModules.getModules()));
}
private static class ModuleList