mirror of https://github.com/apache/druid.git
Merge pull request #1628 from druid-io/revert-1608-guice40
Revert "Update to guice 4.0"
This commit is contained in:
commit
c1d274faff
|
@ -72,14 +72,14 @@ public class DruidSecondaryModule implements Module
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides @LazySingleton @Json
|
@Provides @LazySingleton @Json
|
||||||
public final ObjectMapper getJsonMapper(final Injector injector)
|
public ObjectMapper getJsonMapper(final Injector injector)
|
||||||
{
|
{
|
||||||
setupJackson(injector, jsonMapper);
|
setupJackson(injector, jsonMapper);
|
||||||
return jsonMapper;
|
return jsonMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides @LazySingleton @Smile
|
@Provides @LazySingleton @Smile
|
||||||
public final ObjectMapper getSmileMapper(Injector injector)
|
public ObjectMapper getSmileMapper(Injector injector)
|
||||||
{
|
{
|
||||||
setupJackson(injector, smileMapper);
|
setupJackson(injector, smileMapper);
|
||||||
return smileMapper;
|
return smileMapper;
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class JacksonConfigManagerModule implements Module
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides @ManageLifecycle
|
@Provides @ManageLifecycle
|
||||||
public final ConfigManager getConfigManager(
|
public ConfigManager getConfigManager(
|
||||||
final MetadataStorageConnector dbConnector,
|
final MetadataStorageConnector dbConnector,
|
||||||
final Supplier<MetadataStorageTablesConfig> dbTables,
|
final Supplier<MetadataStorageTablesConfig> dbTables,
|
||||||
final Supplier<ConfigManagerConfig> config,
|
final Supplier<ConfigManagerConfig> config,
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class AzureStorageDruidModule implements DruidModule
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final CloudBlobClient getCloudBlobClient(final AzureAccountConfig config)
|
public CloudBlobClient getCloudBlobClient(final AzureAccountConfig config)
|
||||||
throws URISyntaxException, InvalidKeyException
|
throws URISyntaxException, InvalidKeyException
|
||||||
{
|
{
|
||||||
CloudStorageAccount account = CloudStorageAccount.parse(
|
CloudStorageAccount account = CloudStorageAccount.parse(
|
||||||
|
@ -115,7 +115,7 @@ public class AzureStorageDruidModule implements DruidModule
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final AzureStorage getAzureStorageContainer(
|
public AzureStorage getAzureStorageContainer(
|
||||||
final CloudBlobClient cloudBlobClient
|
final CloudBlobClient cloudBlobClient
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,15 +71,7 @@ public class KafkaExtractionNamespaceModule implements DruidModule
|
||||||
@Provides
|
@Provides
|
||||||
@Named("renameKafkaProperties")
|
@Named("renameKafkaProperties")
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final Properties getProperties(
|
public Properties getProperties(
|
||||||
@Json ObjectMapper mapper,
|
|
||||||
Properties systemProperties
|
|
||||||
){
|
|
||||||
return getPropertiesInner(mapper, systemProperties);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Protected for use in unit tests
|
|
||||||
protected Properties getPropertiesInner(
|
|
||||||
@Json ObjectMapper mapper,
|
@Json ObjectMapper mapper,
|
||||||
Properties systemProperties
|
Properties systemProperties
|
||||||
)
|
)
|
||||||
|
@ -106,7 +98,7 @@ public class KafkaExtractionNamespaceModule implements DruidModule
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final KafkaExtractionNamespaceFactory factoryFactory(
|
public KafkaExtractionNamespaceFactory factoryFactory(
|
||||||
KafkaExtractionManager kafkaManager
|
KafkaExtractionManager kafkaManager
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,9 @@ import com.google.inject.Key;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
import com.google.inject.multibindings.MapBinder;
|
||||||
|
import com.google.inject.multibindings.Multibinder;
|
||||||
|
import com.google.inject.name.Named;
|
||||||
import com.google.inject.name.Names;
|
import com.google.inject.name.Names;
|
||||||
import com.metamx.common.ISE;
|
import com.metamx.common.ISE;
|
||||||
import com.metamx.common.StringUtils;
|
import com.metamx.common.StringUtils;
|
||||||
|
@ -55,6 +58,10 @@ import kafka.utils.ZKStringSerializer$;
|
||||||
import org.I0Itec.zkclient.ZkClient;
|
import org.I0Itec.zkclient.ZkClient;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.curator.test.TestingServer;
|
import org.apache.curator.test.TestingServer;
|
||||||
|
import org.apache.log4j.BasicConfigurator;
|
||||||
|
import org.apache.log4j.ConsoleAppender;
|
||||||
|
import org.apache.log4j.Level;
|
||||||
|
import org.apache.log4j.PatternLayout;
|
||||||
import org.apache.zookeeper.CreateMode;
|
import org.apache.zookeeper.CreateMode;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
@ -90,18 +97,16 @@ public class TestKafkaExtractionCluster
|
||||||
private static Injector injector;
|
private static Injector injector;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static class KafkaFactoryProvider implements Provider<ExtractionNamespaceFunctionFactory<?>>
|
public static class KafkaFactoryProvider implements Provider<ExtractionNamespaceFunctionFactory<?>>
|
||||||
{
|
{
|
||||||
private final KafkaExtractionManager kafkaExtractionManager;
|
private final KafkaExtractionManager kafkaExtractionManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public KafkaFactoryProvider(
|
public KafkaFactoryProvider(
|
||||||
KafkaExtractionManager kafkaExtractionManager
|
KafkaExtractionManager kafkaExtractionManager
|
||||||
)
|
){
|
||||||
{
|
|
||||||
this.kafkaExtractionManager = kafkaExtractionManager;
|
this.kafkaExtractionManager = kafkaExtractionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExtractionNamespaceFunctionFactory<?> get()
|
public ExtractionNamespaceFunctionFactory<?> get()
|
||||||
{
|
{
|
||||||
|
@ -217,10 +222,6 @@ public class TestKafkaExtractionCluster
|
||||||
}
|
}
|
||||||
|
|
||||||
System.setProperty("druid.extensions.searchCurrentClassloader", "false");
|
System.setProperty("druid.extensions.searchCurrentClassloader", "false");
|
||||||
final Properties consumerProperties = new Properties(kafkaProperties);
|
|
||||||
consumerProperties.put("zookeeper.connect", zkTestServer.getConnectString() + "/kafka");
|
|
||||||
consumerProperties.put("zookeeper.session.timeout.ms", "10000");
|
|
||||||
consumerProperties.put("zookeeper.sync.time.ms", "200");
|
|
||||||
|
|
||||||
injector = Initialization.makeInjectorWithModules(
|
injector = Initialization.makeInjectorWithModules(
|
||||||
GuiceInjectors.makeStartupInjectorWithModules(
|
GuiceInjectors.makeStartupInjectorWithModules(
|
||||||
|
@ -238,11 +239,15 @@ public class TestKafkaExtractionCluster
|
||||||
new KafkaExtractionNamespaceModule()
|
new KafkaExtractionNamespaceModule()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected Properties getPropertiesInner(
|
public Properties getProperties(
|
||||||
@Json ObjectMapper mapper,
|
@Json ObjectMapper mapper,
|
||||||
Properties systemProperties
|
Properties systemProperties
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
final Properties consumerProperties = new Properties(kafkaProperties);
|
||||||
|
consumerProperties.put("zookeeper.connect", zkTestServer.getConnectString() + "/kafka");
|
||||||
|
consumerProperties.put("zookeeper.session.timeout.ms", "10000");
|
||||||
|
consumerProperties.put("zookeeper.sync.time.ms", "200");
|
||||||
return consumerProperties;
|
return consumerProperties;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,8 +287,7 @@ public class TestKafkaExtractionCluster
|
||||||
if (zkClient.exists("/kafka")) {
|
if (zkClient.exists("/kafka")) {
|
||||||
try {
|
try {
|
||||||
zkClient.deleteRecursive("/kafka");
|
zkClient.deleteRecursive("/kafka");
|
||||||
}
|
}catch(org.I0Itec.zkclient.exception.ZkException ex){
|
||||||
catch (org.I0Itec.zkclient.exception.ZkException ex) {
|
|
||||||
log.warn(ex, "error deleting /kafka zk node");
|
log.warn(ex, "error deleting /kafka zk node");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,13 +296,12 @@ public class TestKafkaExtractionCluster
|
||||||
if (null != zkTestServer) {
|
if (null != zkTestServer) {
|
||||||
zkTestServer.stop();
|
zkTestServer.stop();
|
||||||
}
|
}
|
||||||
if (tmpDir.exists()) {
|
if(tmpDir.exists()){
|
||||||
FileUtils.deleteDirectory(tmpDir);
|
FileUtils.deleteDirectory(tmpDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Properties makeProducerProperties()
|
private static final Properties makeProducerProperties(){
|
||||||
{
|
|
||||||
final Properties kafkaProducerProperties = new Properties();
|
final Properties kafkaProducerProperties = new Properties();
|
||||||
kafkaProducerProperties.putAll(kafkaProperties);
|
kafkaProducerProperties.putAll(kafkaProperties);
|
||||||
kafkaProducerProperties.put(
|
kafkaProducerProperties.put(
|
||||||
|
@ -324,16 +327,7 @@ public class TestKafkaExtractionCluster
|
||||||
final Producer<byte[], byte[]> producer = new Producer<byte[], byte[]>(new ProducerConfig(kafkaProducerProperties));
|
final Producer<byte[], byte[]> producer = new Producer<byte[], byte[]>(new ProducerConfig(kafkaProducerProperties));
|
||||||
try {
|
try {
|
||||||
checkServer();
|
checkServer();
|
||||||
final ConcurrentMap<String, Function<String, String>> fnFn = injector.getInstance(
|
final ConcurrentMap<String, Function<String, String>> fnFn = injector.getInstance(Key.get(new TypeLiteral<ConcurrentMap<String, Function<String, String>>>(){}, Names.named("namespaceExtractionFunctionCache")));
|
||||||
Key.get(
|
|
||||||
new TypeLiteral<ConcurrentMap<String, Function<String, String>>>()
|
|
||||||
{
|
|
||||||
},
|
|
||||||
Names.named(
|
|
||||||
"namespaceExtractionFunctionCache"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
KafkaExtractionNamespace extractionNamespace = new KafkaExtractionNamespace(topicName, namespace);
|
KafkaExtractionNamespace extractionNamespace = new KafkaExtractionNamespace(topicName, namespace);
|
||||||
|
|
||||||
Assert.assertEquals(null, fnFn.get(extractionNamespace.getNamespace()).apply("foo"));
|
Assert.assertEquals(null, fnFn.get(extractionNamespace.getNamespace()).apply("foo"));
|
||||||
|
|
|
@ -164,14 +164,14 @@ public class NamespacedExtractionModule implements DruidModule
|
||||||
@Provides
|
@Provides
|
||||||
@Named("namespaceVersionMap")
|
@Named("namespaceVersionMap")
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final ConcurrentMap<String, String> getVersionMap()
|
public ConcurrentMap<String, String> getVersionMap()
|
||||||
{
|
{
|
||||||
return new ConcurrentHashMap<>();
|
return new ConcurrentHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Named("namespaceExtractionFunctionCache")
|
@Named("namespaceExtractionFunctionCache")
|
||||||
public final ConcurrentMap<String, Function<String, String>> getFnCache()
|
public ConcurrentMap<String, Function<String, String>> getFnCache()
|
||||||
{
|
{
|
||||||
return fnCache;
|
return fnCache;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ public class NamespacedExtractionModule implements DruidModule
|
||||||
@Provides
|
@Provides
|
||||||
@Named("dimExtractionNamespace")
|
@Named("dimExtractionNamespace")
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final Function<String, Function<String, String>> getFunctionMaker(
|
public Function<String, Function<String, String>> getFunctionMaker(
|
||||||
@Named("namespaceExtractionFunctionCache")
|
@Named("namespaceExtractionFunctionCache")
|
||||||
final ConcurrentMap<String, Function<String, String>> fnCache
|
final ConcurrentMap<String, Function<String, String>> fnCache
|
||||||
)
|
)
|
||||||
|
|
|
@ -95,14 +95,14 @@ public class S3StorageDruidModule implements DruidModule
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final AWSCredentialsProvider getAWSCredentialsProvider(final AWSCredentialsConfig config)
|
public AWSCredentialsProvider getAWSCredentialsProvider(final AWSCredentialsConfig config)
|
||||||
{
|
{
|
||||||
return AWSCredentialsUtils.defaultAWSCredentialsProviderChain(config);
|
return AWSCredentialsUtils.defaultAWSCredentialsProviderChain(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final RestS3Service getRestS3Service(AWSCredentialsProvider provider)
|
public RestS3Service getRestS3Service(AWSCredentialsProvider provider)
|
||||||
{
|
{
|
||||||
if(provider.getCredentials() instanceof com.amazonaws.auth.AWSSessionCredentials) {
|
if(provider.getCredentials() instanceof com.amazonaws.auth.AWSSessionCredentials) {
|
||||||
return new RestS3Service(new AWSSessionCredentialsAdapter(provider));
|
return new RestS3Service(new AWSSessionCredentialsAdapter(provider));
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class DruidTestModule implements Module
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final ServiceEmitter getServiceEmitter(Supplier<LoggingEmitterConfig> config, ObjectMapper jsonMapper)
|
public ServiceEmitter getServiceEmitter(Supplier<LoggingEmitterConfig> config, ObjectMapper jsonMapper)
|
||||||
{
|
{
|
||||||
return new ServiceEmitter("", "", new LoggingEmitter(config.get(), jsonMapper));
|
return new ServiceEmitter("", "", new LoggingEmitter(config.get(), jsonMapper));
|
||||||
}
|
}
|
||||||
|
|
9
pom.xml
9
pom.xml
|
@ -69,12 +69,11 @@
|
||||||
<apache.curator.version>2.8.0</apache.curator.version>
|
<apache.curator.version>2.8.0</apache.curator.version>
|
||||||
<jetty.version>9.2.5.v20141112</jetty.version>
|
<jetty.version>9.2.5.v20141112</jetty.version>
|
||||||
<jersey.version>1.19</jersey.version>
|
<jersey.version>1.19</jersey.version>
|
||||||
<druid.api.version>0.3.10</druid.api.version>
|
<druid.api.version>0.3.9</druid.api.version>
|
||||||
<jackson.version>2.4.4</jackson.version>
|
<jackson.version>2.4.4</jackson.version>
|
||||||
<log4j.version>2.2</log4j.version>
|
<log4j.version>2.2</log4j.version>
|
||||||
<slf4j.version>1.7.10</slf4j.version>
|
<slf4j.version>1.7.10</slf4j.version>
|
||||||
<hadoop.compile.version>2.3.0</hadoop.compile.version>
|
<hadoop.compile.version>2.3.0</hadoop.compile.version>
|
||||||
<guice.version>4.0</guice.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@ -236,17 +235,17 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.inject</groupId>
|
<groupId>com.google.inject</groupId>
|
||||||
<artifactId>guice</artifactId>
|
<artifactId>guice</artifactId>
|
||||||
<version>${guice.version}</version>
|
<version>4.0-beta</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.inject.extensions</groupId>
|
<groupId>com.google.inject.extensions</groupId>
|
||||||
<artifactId>guice-servlet</artifactId>
|
<artifactId>guice-servlet</artifactId>
|
||||||
<version>${guice.version}</version>
|
<version>4.0-beta</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.inject.extensions</groupId>
|
<groupId>com.google.inject.extensions</groupId>
|
||||||
<artifactId>guice-multibindings</artifactId>
|
<artifactId>guice-multibindings</artifactId>
|
||||||
<version>${guice.version}</version>
|
<version>4.0-beta</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ibm.icu</groupId>
|
<groupId>com.ibm.icu</groupId>
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ConfigModule implements Module
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides @LazySingleton
|
@Provides @LazySingleton
|
||||||
public final ConfigurationObjectFactory makeFactory(Properties props)
|
public ConfigurationObjectFactory makeFactory(Properties props)
|
||||||
{
|
{
|
||||||
return Config.createFactory(props);
|
return Config.createFactory(props);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,13 @@ public class JacksonModule implements Module
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides @LazySingleton @Json
|
@Provides @LazySingleton @Json
|
||||||
public final ObjectMapper jsonMapper()
|
public ObjectMapper jsonMapper()
|
||||||
{
|
{
|
||||||
return new DefaultObjectMapper();
|
return new DefaultObjectMapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides @LazySingleton @Smile
|
@Provides @LazySingleton @Smile
|
||||||
public final ObjectMapper smileMapper()
|
public ObjectMapper smileMapper()
|
||||||
{
|
{
|
||||||
final SmileFactory smileFactory = new SmileFactory();
|
final SmileFactory smileFactory = new SmileFactory();
|
||||||
smileFactory.configure(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT, false);
|
smileFactory.configure(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT, false);
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class MetadataStorageTablesConfigTest
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final ObjectMapper jsonMapper()
|
public ObjectMapper jsonMapper()
|
||||||
{
|
{
|
||||||
return new DefaultObjectMapper();
|
return new DefaultObjectMapper();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class CuratorModule implements Module
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides @LazySingleton
|
@Provides @LazySingleton
|
||||||
public final CuratorFramework makeCurator(CuratorConfig config, Lifecycle lifecycle) throws IOException
|
public CuratorFramework makeCurator(CuratorConfig config, Lifecycle lifecycle) throws IOException
|
||||||
{
|
{
|
||||||
final CuratorFramework framework =
|
final CuratorFramework framework =
|
||||||
CuratorFrameworkFactory.builder()
|
CuratorFrameworkFactory.builder()
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class DiscoveryModule implements Module
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
@Named(NAME)
|
@Named(NAME)
|
||||||
public final CuratorServiceAnnouncer getServiceAnnouncer(
|
public CuratorServiceAnnouncer getServiceAnnouncer(
|
||||||
final CuratorServiceAnnouncer announcer,
|
final CuratorServiceAnnouncer announcer,
|
||||||
final Injector injector,
|
final Injector injector,
|
||||||
final Set<KeyHolder<DruidNode>> nodesToAnnounce,
|
final Set<KeyHolder<DruidNode>> nodesToAnnounce,
|
||||||
|
@ -190,7 +190,7 @@ public class DiscoveryModule implements Module
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final ServiceDiscovery<Void> getServiceDiscovery(
|
public ServiceDiscovery<Void> getServiceDiscovery(
|
||||||
CuratorFramework curator,
|
CuratorFramework curator,
|
||||||
CuratorDiscoveryConfig config,
|
CuratorDiscoveryConfig config,
|
||||||
Lifecycle lifecycle
|
Lifecycle lifecycle
|
||||||
|
@ -233,7 +233,7 @@ public class DiscoveryModule implements Module
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final ServerDiscoveryFactory getServerDiscoveryFactory(
|
public ServerDiscoveryFactory getServerDiscoveryFactory(
|
||||||
ServiceDiscovery<Void> serviceDiscovery
|
ServiceDiscovery<Void> serviceDiscovery
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,14 +38,14 @@ public class AWSModule implements Module
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final AWSCredentialsProvider getAWSCredentialsProvider(final AWSCredentialsConfig config)
|
public AWSCredentialsProvider getAWSCredentialsProvider(final AWSCredentialsConfig config)
|
||||||
{
|
{
|
||||||
return AWSCredentialsUtils.defaultAWSCredentialsProviderChain(config);
|
return AWSCredentialsUtils.defaultAWSCredentialsProviderChain(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final AmazonEC2 getEc2Client(AWSCredentialsProvider credentials)
|
public AmazonEC2 getEc2Client(AWSCredentialsProvider credentials)
|
||||||
{
|
{
|
||||||
return new AmazonEC2Client(credentials);
|
return new AmazonEC2Client(credentials);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class AnnouncerModule implements Module
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@ManageLifecycle
|
@ManageLifecycle
|
||||||
public final Announcer getAnnouncer(CuratorFramework curator)
|
public Announcer getAnnouncer(CuratorFramework curator)
|
||||||
{
|
{
|
||||||
return new Announcer(curator, Execs.singleThreaded("Announcer-%s"));
|
return new Announcer(curator, Execs.singleThreaded("Announcer-%s"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class DruidProcessingModule implements Module
|
||||||
@Provides
|
@Provides
|
||||||
@BackgroundCaching
|
@BackgroundCaching
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final ExecutorService getBackgroundExecutorService(
|
public ExecutorService getBackgroundExecutorService(
|
||||||
CacheConfig cacheConfig
|
CacheConfig cacheConfig
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ public class DruidProcessingModule implements Module
|
||||||
@Provides
|
@Provides
|
||||||
@Processing
|
@Processing
|
||||||
@ManageLifecycle
|
@ManageLifecycle
|
||||||
public final ExecutorService getProcessingExecutorService(
|
public ExecutorService getProcessingExecutorService(
|
||||||
ExecutorServiceConfig config,
|
ExecutorServiceConfig config,
|
||||||
ServiceEmitter emitter,
|
ServiceEmitter emitter,
|
||||||
Lifecycle lifecycle
|
Lifecycle lifecycle
|
||||||
|
@ -100,7 +100,7 @@ public class DruidProcessingModule implements Module
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
@Global
|
@Global
|
||||||
public final StupidPool<ByteBuffer> getIntermediateResultsPool(DruidProcessingConfig config)
|
public StupidPool<ByteBuffer> getIntermediateResultsPool(DruidProcessingConfig config)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
long maxDirectMemory = VMUtils.getMaxDirectMemory();
|
long maxDirectMemory = VMUtils.getMaxDirectMemory();
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class IndexingServiceDiscoveryModule implements Module
|
||||||
@Provides
|
@Provides
|
||||||
@IndexingService
|
@IndexingService
|
||||||
@ManageLifecycle
|
@ManageLifecycle
|
||||||
public final ServerDiscoverySelector getServiceProvider(
|
public ServerDiscoverySelector getServiceProvider(
|
||||||
IndexingServiceSelectorConfig config,
|
IndexingServiceSelectorConfig config,
|
||||||
ServerDiscoveryFactory serverDiscoveryFactory
|
ServerDiscoveryFactory serverDiscoveryFactory
|
||||||
)
|
)
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class ServerModule implements DruidModule
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides @LazySingleton
|
@Provides @LazySingleton
|
||||||
public final ScheduledExecutorFactory getScheduledExecutorFactory(Lifecycle lifecycle)
|
public ScheduledExecutorFactory getScheduledExecutorFactory(Lifecycle lifecycle)
|
||||||
{
|
{
|
||||||
return ScheduledExecutors.createFactory(lifecycle);
|
return ScheduledExecutors.createFactory(lifecycle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class StorageNodeModule implements Module
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final DruidServerMetadata getMetadata(@Self DruidNode node, @Nullable NodeTypeConfig nodeType, DruidServerConfig config)
|
public DruidServerMetadata getMetadata(@Self DruidNode node, @Nullable NodeTypeConfig nodeType, DruidServerConfig config)
|
||||||
{
|
{
|
||||||
if (nodeType == null) {
|
if (nodeType == null) {
|
||||||
throw new ProvisionException("Must override the binding for NodeTypeConfig if you want a DruidServerMetadata.");
|
throw new ProvisionException("Must override the binding for NodeTypeConfig if you want a DruidServerMetadata.");
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class EmitterModule implements Module
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@ManageLifecycle
|
@ManageLifecycle
|
||||||
public final ServiceEmitter getServiceEmitter(@Self Supplier<DruidNode> configSupplier, Emitter emitter)
|
public ServiceEmitter getServiceEmitter(@Self Supplier<DruidNode> configSupplier, Emitter emitter)
|
||||||
{
|
{
|
||||||
final DruidNode config = configSupplier.get();
|
final DruidNode config = configSupplier.get();
|
||||||
final ServiceEmitter retVal = new ServiceEmitter(config.getServiceName(), config.getHostAndPort(), emitter);
|
final ServiceEmitter retVal = new ServiceEmitter(config.getServiceName(), config.getHostAndPort(), emitter);
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class HttpEmitterModule implements Module
|
||||||
@Provides
|
@Provides
|
||||||
@ManageLifecycle
|
@ManageLifecycle
|
||||||
@Named("http")
|
@Named("http")
|
||||||
public final Emitter getEmitter(
|
public Emitter getEmitter(
|
||||||
Supplier<HttpEmitterConfig> config,
|
Supplier<HttpEmitterConfig> config,
|
||||||
@Nullable SSLContext sslContext,
|
@Nullable SSLContext sslContext,
|
||||||
Lifecycle lifecycle,
|
Lifecycle lifecycle,
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class LogEmitterModule implements Module
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides @ManageLifecycle @Named(EMITTER_TYPE)
|
@Provides @ManageLifecycle @Named(EMITTER_TYPE)
|
||||||
public final Emitter makeEmitter(Supplier<LoggingEmitterConfig> config, ObjectMapper jsonMapper)
|
public Emitter makeEmitter(Supplier<LoggingEmitterConfig> config, ObjectMapper jsonMapper)
|
||||||
{
|
{
|
||||||
return new LoggingEmitter(config.get(), jsonMapper);
|
return new LoggingEmitter(config.get(), jsonMapper);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class NoopEmitterModule implements Module
|
||||||
@Provides
|
@Provides
|
||||||
@ManageLifecycle
|
@ManageLifecycle
|
||||||
@Named(EMITTER_TYPE)
|
@Named(EMITTER_TYPE)
|
||||||
public final Emitter makeEmitter()
|
public Emitter makeEmitter()
|
||||||
{
|
{
|
||||||
return new NoopEmitter();
|
return new NoopEmitter();
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class JettyServerModule extends JerseyServletModule
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final Server getServer(Injector injector, Lifecycle lifecycle, @Self DruidNode node, ServerConfig config)
|
public Server getServer(Injector injector, Lifecycle lifecycle, @Self DruidNode node, ServerConfig config)
|
||||||
{
|
{
|
||||||
JettyServerInitializer initializer = injector.getInstance(JettyServerInitializer.class);
|
JettyServerInitializer initializer = injector.getInstance(JettyServerInitializer.class);
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ public class JettyServerModule extends JerseyServletModule
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
public final JacksonJsonProvider getJacksonJsonProvider(@Json ObjectMapper objectMapper)
|
public JacksonJsonProvider getJacksonJsonProvider(@Json ObjectMapper objectMapper)
|
||||||
{
|
{
|
||||||
final JacksonJsonProvider provider = new JacksonJsonProvider();
|
final JacksonJsonProvider provider = new JacksonJsonProvider();
|
||||||
provider.setMapper(objectMapper);
|
provider.setMapper(objectMapper);
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class MetricsModule implements Module
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@ManageLifecycle
|
@ManageLifecycle
|
||||||
public final MonitorScheduler getMonitorScheduler(
|
public MonitorScheduler getMonitorScheduler(
|
||||||
Supplier<DruidMonitorSchedulerConfig> config,
|
Supplier<DruidMonitorSchedulerConfig> config,
|
||||||
MonitorsConfig monitorsConfig,
|
MonitorsConfig monitorsConfig,
|
||||||
Set<Class<? extends Monitor>> monitorSet,
|
Set<Class<? extends Monitor>> monitorSet,
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class CliBridge extends ServerRunnable
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
@Bridge
|
@Bridge
|
||||||
public final CuratorFramework getBridgeCurator(final BridgeCuratorConfig bridgeCuratorConfig, Lifecycle lifecycle)
|
public CuratorFramework getBridgeCurator(final BridgeCuratorConfig bridgeCuratorConfig, Lifecycle lifecycle)
|
||||||
{
|
{
|
||||||
final CuratorFramework framework =
|
final CuratorFramework framework =
|
||||||
CuratorFrameworkFactory.builder()
|
CuratorFrameworkFactory.builder()
|
||||||
|
@ -156,7 +156,7 @@ public class CliBridge extends ServerRunnable
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@ManageLifecycle
|
@ManageLifecycle
|
||||||
public final ServerDiscoverySelector getServerDiscoverySelector(
|
public ServerDiscoverySelector getServerDiscoverySelector(
|
||||||
DruidClusterBridgeConfig config,
|
DruidClusterBridgeConfig config,
|
||||||
ServerDiscoveryFactory factory
|
ServerDiscoveryFactory factory
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ public class CliBridge extends ServerRunnable
|
||||||
@Provides
|
@Provides
|
||||||
@ManageLifecycle
|
@ManageLifecycle
|
||||||
@Bridge
|
@Bridge
|
||||||
public final Announcer getBridgeAnnouncer(
|
public Announcer getBridgeAnnouncer(
|
||||||
@Bridge CuratorFramework curator
|
@Bridge CuratorFramework curator
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -178,7 +178,7 @@ public class CliBridge extends ServerRunnable
|
||||||
@Provides
|
@Provides
|
||||||
@ManageLifecycleLast
|
@ManageLifecycleLast
|
||||||
@Bridge
|
@Bridge
|
||||||
public final AbstractDataSegmentAnnouncer getBridgeDataSegmentAnnouncer(
|
public AbstractDataSegmentAnnouncer getBridgeDataSegmentAnnouncer(
|
||||||
DruidServerMetadata metadata,
|
DruidServerMetadata metadata,
|
||||||
BatchDataSegmentAnnouncerConfig config,
|
BatchDataSegmentAnnouncerConfig config,
|
||||||
ZkPathsConfig zkPathsConfig,
|
ZkPathsConfig zkPathsConfig,
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class CliCoordinator extends ServerRunnable
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final LoadQueueTaskMaster getLoadQueueTaskMaster(
|
public LoadQueueTaskMaster getLoadQueueTaskMaster(
|
||||||
CuratorFramework curator,
|
CuratorFramework curator,
|
||||||
ObjectMapper jsonMapper,
|
ObjectMapper jsonMapper,
|
||||||
ScheduledExecutorFactory factory,
|
ScheduledExecutorFactory factory,
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class CliMiddleManager extends ServerRunnable
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@LazySingleton
|
@LazySingleton
|
||||||
public final Worker getWorker(@Self DruidNode node, WorkerConfig config)
|
public Worker getWorker(@Self DruidNode node, WorkerConfig config)
|
||||||
{
|
{
|
||||||
return new Worker(
|
return new Worker(
|
||||||
node.getHostAndPort(),
|
node.getHostAndPort(),
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class CliRouter extends ServerRunnable
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@ManageLifecycle
|
@ManageLifecycle
|
||||||
public final ServerDiscoverySelector getCoordinatorServerDiscoverySelector(
|
public ServerDiscoverySelector getCoordinatorServerDiscoverySelector(
|
||||||
TieredBrokerConfig config,
|
TieredBrokerConfig config,
|
||||||
ServerDiscoveryFactory factory
|
ServerDiscoveryFactory factory
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue