fix nodes not able to start

This commit is contained in:
Fangjin Yang 2013-03-19 12:35:02 -07:00
parent d53822130b
commit 69a0e0e1a7
2 changed files with 20 additions and 7 deletions

View File

@ -148,6 +148,7 @@ public class IndexerCoordinatorNode extends RegisteringNode
private IndexerZkConfig indexerZkConfig;
private TaskRunnerFactory taskRunnerFactory = null;
private ResourceManagementSchedulerFactory resourceManagementSchedulerFactory = null;
private HttpClient httpClient = null;
private TaskActionClientFactory taskActionClientFactory = null;
private TaskMasterLifecycle taskMasterLifecycle = null;
private Server server = null;
@ -217,6 +218,12 @@ public class IndexerCoordinatorNode extends RegisteringNode
return this;
}
public IndexerCoordinatorNode setHttpClient(HttpClient httpClient)
{
this.httpClient = httpClient;
return this;
}
public void doInit() throws Exception
{
scheduledExecutorFactory = ScheduledExecutors.createFactory(lifecycle);
@ -234,6 +241,7 @@ public class IndexerCoordinatorNode extends RegisteringNode
), getJsonMapper()
);
initializeHttpClient();
initializeEmitter();
initializeMonitors();
initializeIndexerCoordinatorConfig();
@ -410,13 +418,18 @@ public class IndexerCoordinatorNode extends RegisteringNode
getJsonMapper().registerSubtypes(StaticS3FirehoseFactory.class);
}
private void initializeHttpClient()
{
if (httpClient == null) {
httpClient = HttpClientInit.createClient(
HttpClientConfig.builder().withNumConnections(1).build(), lifecycle
);
}
}
private void initializeEmitter()
{
if (emitter == null) {
final HttpClient httpClient = HttpClientInit.createClient(
HttpClientConfig.builder().withNumConnections(1).build(), lifecycle
);
emitter = new ServiceEmitter(
PropUtils.getProperty(props, "druid.service"),
PropUtils.getProperty(props, "druid.host"),
@ -546,9 +559,7 @@ public class IndexerCoordinatorNode extends RegisteringNode
)
),
configManager.watch(WorkerSetupData.CONFIG_KEY, WorkerSetupData.class),
HttpClientInit.createClient(
HttpClientConfig.builder().withNumConnections(1).build(), lifecycle
)
httpClient
);
return remoteTaskRunner;

View File

@ -24,6 +24,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceFilter;
import com.metamx.common.concurrent.ScheduledExecutorFactory;
import com.metamx.common.concurrent.ScheduledExecutors;
import com.metamx.common.config.Config;
@ -207,6 +208,7 @@ public class WorkerNode extends RegisteringNode
root.addServlet(new ServletHolder(new StatusServlet()), "/status");
root.addEventListener(new GuiceServletConfig(injector));
root.addFilter(GuiceFilter.class, "/mmx/worker/v1/*", 0);
}
@LifecycleStart