Merge pull request #2688 from pjain1/props_cli

do not inject properties directly in module
This commit is contained in:
Bingkun Guo 2016-03-22 15:27:19 -05:00
commit a6e9ff48ec
4 changed files with 23 additions and 6 deletions

View File

@ -20,7 +20,6 @@
package io.druid.server.initialization.jetty;
import com.google.inject.Binder;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Module;
@ -48,8 +47,11 @@ public class ChatHandlerServerModule implements Module
private static final String MAX_CHAT_REQUESTS_PROPERTY = "druid.indexer.server.maxChatRequests";
private static final String CHAT_PORT_PROPERTY = "druid.indexer.task.chathandler.port";
@Inject
private Properties properties;
private final Properties properties;
public ChatHandlerServerModule(Properties properties) {
this.properties = properties;
}
@Override
public void configure(Binder binder)

View File

@ -22,6 +22,7 @@ package io.druid.cli;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.inject.Binder;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Module;
@ -85,6 +86,7 @@ import org.eclipse.jetty.server.Server;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.Set;
/**
@ -104,6 +106,9 @@ public class CliPeon extends GuiceRunnable
private static final Logger log = new Logger(CliPeon.class);
@Inject
private Properties properties;
public CliPeon()
{
super(log);
@ -220,7 +225,7 @@ public class CliPeon extends GuiceRunnable
}
},
new IndexingServiceFirehoseModule(),
new ChatHandlerServerModule(),
new ChatHandlerServerModule(properties),
new LookupModule()
);
}

View File

@ -21,6 +21,7 @@ package io.druid.cli;
import com.google.common.collect.ImmutableList;
import com.google.inject.Binder;
import com.google.inject.Inject;
import com.google.inject.Module;
import com.google.inject.name.Names;
import com.metamx.common.logger.Logger;
@ -30,6 +31,7 @@ import io.druid.query.lookup.LookupModule;
import io.druid.server.initialization.jetty.ChatHandlerServerModule;
import java.util.List;
import java.util.Properties;
/**
*/
@ -41,6 +43,9 @@ public class CliRealtime extends ServerRunnable
{
private static final Logger log = new Logger(CliRealtime.class);
@Inject
private Properties properties;
public CliRealtime()
{
super(log);
@ -60,7 +65,7 @@ public class CliRealtime extends ServerRunnable
binder.bindConstant().annotatedWith(Names.named("servicePort")).to(8084);
}
},
new ChatHandlerServerModule(),
new ChatHandlerServerModule(properties),
new LookupModule()
);
}

View File

@ -21,6 +21,7 @@ package io.druid.cli;
import com.google.common.collect.ImmutableList;
import com.google.inject.Binder;
import com.google.inject.Inject;
import com.google.inject.Module;
import com.google.inject.name.Names;
import com.metamx.common.logger.Logger;
@ -39,6 +40,7 @@ import io.druid.timeline.DataSegment;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.Executor;
/**
@ -51,6 +53,9 @@ public class CliRealtimeExample extends ServerRunnable
{
private static final Logger log = new Logger(CliBroker.class);
@Inject
private Properties properties;
public CliRealtimeExample()
{
super(log);
@ -75,7 +80,7 @@ public class CliRealtimeExample extends ServerRunnable
binder.bind(ServerView.class).to(NoopServerView.class).in(LazySingleton.class);
}
},
new ChatHandlerServerModule(),
new ChatHandlerServerModule(properties),
new LookupModule()
);
}