Merge pull request #2581 from gianm/fix-deadlock

CliPeon: Fix deadlock on startup by eagerly creating ExecutorLifecycle, ChatHandlerResource.
This commit is contained in:
Fangjin Yang 2016-03-02 11:37:49 -08:00
commit 612e327426
2 changed files with 2 additions and 1 deletions

View File

@ -55,6 +55,7 @@ public class ChatHandlerServerModule implements Module
public void configure(Binder binder) public void configure(Binder binder)
{ {
Jerseys.addResource(binder, ChatHandlerResource.class); Jerseys.addResource(binder, ChatHandlerResource.class);
LifecycleModule.register(binder, ChatHandlerResource.class);
if (properties.containsKey(MAX_CHAT_REQUESTS_PROPERTY)) { if (properties.containsKey(MAX_CHAT_REQUESTS_PROPERTY)) {
final int maxRequests = Integer.parseInt(properties.getProperty(MAX_CHAT_REQUESTS_PROPERTY)); final int maxRequests = Integer.parseInt(properties.getProperty(MAX_CHAT_REQUESTS_PROPERTY));

View File

@ -72,7 +72,6 @@ import io.druid.segment.loading.OmniDataSegmentMover;
import io.druid.segment.loading.SegmentLoaderConfig; import io.druid.segment.loading.SegmentLoaderConfig;
import io.druid.segment.loading.StorageLocationConfig; import io.druid.segment.loading.StorageLocationConfig;
import io.druid.segment.realtime.firehose.ChatHandlerProvider; import io.druid.segment.realtime.firehose.ChatHandlerProvider;
import io.druid.segment.realtime.firehose.ChatHandlerResource;
import io.druid.segment.realtime.firehose.NoopChatHandlerProvider; import io.druid.segment.realtime.firehose.NoopChatHandlerProvider;
import io.druid.segment.realtime.firehose.ServiceAnnouncingChatHandlerProvider; import io.druid.segment.realtime.firehose.ServiceAnnouncingChatHandlerProvider;
import io.druid.segment.realtime.plumber.CoordinatorBasedSegmentHandoffNotifierConfig; import io.druid.segment.realtime.plumber.CoordinatorBasedSegmentHandoffNotifierConfig;
@ -157,6 +156,7 @@ public class CliPeon extends GuiceRunnable
binder.bind(DataSegmentArchiver.class).to(OmniDataSegmentArchiver.class).in(LazySingleton.class); binder.bind(DataSegmentArchiver.class).to(OmniDataSegmentArchiver.class).in(LazySingleton.class);
binder.bind(ExecutorLifecycle.class).in(ManageLifecycle.class); binder.bind(ExecutorLifecycle.class).in(ManageLifecycle.class);
LifecycleModule.register(binder, ExecutorLifecycle.class);
binder.bind(ExecutorLifecycleConfig.class).toInstance( binder.bind(ExecutorLifecycleConfig.class).toInstance(
new ExecutorLifecycleConfig() new ExecutorLifecycleConfig()
.setTaskFile(new File(taskAndStatusFile.get(0))) .setTaskFile(new File(taskAndStatusFile.get(0)))