helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject git commit: [HELIX-390] Force message handler registration even when ZK connection state is flaky
Date Tue, 11 Mar 2014 20:24:35 GMT
Repository: helix
Updated Branches:
  refs/heads/helix-0.6.2-release bee3dde0c -> b6b7807dd


[HELIX-390] Force message handler registration even when ZK connection state is flaky


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/b6b7807d
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/b6b7807d
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/b6b7807d

Branch: refs/heads/helix-0.6.2-release
Commit: b6b7807dd1f5b14727feeab1e7001a5d12aa256e
Parents: bee3dde
Author: Kanak Biscuitwala <kanak@apache.org>
Authored: Fri Feb 21 14:13:21 2014 -0800
Committer: Kanak Biscuitwala <kanak@apache.org>
Committed: Tue Mar 11 13:22:01 2014 -0700

----------------------------------------------------------------------
 .../manager/zk/ParticipantManagerHelper.java    |  1 +
 .../messaging/DefaultMessagingService.java      | 45 +++++++++++---------
 2 files changed, 25 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/b6b7807d/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManagerHelper.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManagerHelper.java
b/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManagerHelper.java
index e7f9efb..cfce1da 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManagerHelper.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManagerHelper.java
@@ -277,6 +277,7 @@ public class ParticipantManagerHelper {
         new ScheduledTaskStateModelFactory(_messagingService.getExecutor());
     _stateMachineEngine.registerStateModelFactory(
         DefaultSchedulerMessageHandlerFactory.SCHEDULER_TASK_QUEUE, stStateModelFactory);
+    _messagingService.onConnected();
 
   }
 

http://git-wip-us.apache.org/repos/asf/helix/blob/b6b7807d/helix-core/src/main/java/org/apache/helix/messaging/DefaultMessagingService.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/messaging/DefaultMessagingService.java
b/helix-core/src/main/java/org/apache/helix/messaging/DefaultMessagingService.java
index 2eec354..1121689 100644
--- a/helix-core/src/main/java/org/apache/helix/messaging/DefaultMessagingService.java
+++ b/helix-core/src/main/java/org/apache/helix/messaging/DefaultMessagingService.java
@@ -28,8 +28,6 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.helix.ClusterMessagingService;
 import org.apache.helix.ConfigAccessor;
-import org.apache.helix.model.ConfigScope;
-import org.apache.helix.model.builder.ConfigScopeBuilder;
 import org.apache.helix.Criteria;
 import org.apache.helix.HelixDataAccessor;
 import org.apache.helix.HelixManager;
@@ -38,9 +36,11 @@ import org.apache.helix.PropertyKey.Builder;
 import org.apache.helix.messaging.handling.AsyncCallbackService;
 import org.apache.helix.messaging.handling.HelixTaskExecutor;
 import org.apache.helix.messaging.handling.MessageHandlerFactory;
+import org.apache.helix.model.ConfigScope;
 import org.apache.helix.model.LiveInstance;
 import org.apache.helix.model.Message;
 import org.apache.helix.model.Message.MessageType;
+import org.apache.helix.model.builder.ConfigScopeBuilder;
 import org.apache.log4j.Logger;
 
 public class DefaultMessagingService implements ClusterMessagingService {
@@ -256,32 +256,35 @@ public class DefaultMessagingService implements ClusterMessagingService
{
     // we have a chance to process the message that we received with the new
     // added MessageHandlerFactory
     // before the factory is added.
-    sendNopMessage();
+    sendNopMessageInternal();
   }
 
+  @Deprecated
   public void sendNopMessage() {
-    if (_manager.isConnected()) {
-      try {
-        Message nopMsg = new Message(MessageType.NO_OP, UUID.randomUUID().toString());
-        nopMsg.setSrcName(_manager.getInstanceName());
+    sendNopMessageInternal();
+  }
 
-        HelixDataAccessor accessor = _manager.getHelixDataAccessor();
-        Builder keyBuilder = accessor.keyBuilder();
+  private void sendNopMessageInternal() {
+    try {
+      Message nopMsg = new Message(MessageType.NO_OP, UUID.randomUUID().toString());
+      nopMsg.setSrcName(_manager.getInstanceName());
 
-        if (_manager.getInstanceType() == InstanceType.CONTROLLER
-            || _manager.getInstanceType() == InstanceType.CONTROLLER_PARTICIPANT) {
-          nopMsg.setTgtName("Controller");
-          accessor.setProperty(keyBuilder.controllerMessage(nopMsg.getId()), nopMsg);
-        }
+      HelixDataAccessor accessor = _manager.getHelixDataAccessor();
+      Builder keyBuilder = accessor.keyBuilder();
 
-        if (_manager.getInstanceType() == InstanceType.PARTICIPANT
-            || _manager.getInstanceType() == InstanceType.CONTROLLER_PARTICIPANT) {
-          nopMsg.setTgtName(_manager.getInstanceName());
-          accessor.setProperty(keyBuilder.message(nopMsg.getTgtName(), nopMsg.getId()), nopMsg);
-        }
-      } catch (Exception e) {
-        _logger.error(e);
+      if (_manager.getInstanceType() == InstanceType.CONTROLLER
+          || _manager.getInstanceType() == InstanceType.CONTROLLER_PARTICIPANT) {
+        nopMsg.setTgtName("Controller");
+        accessor.setProperty(keyBuilder.controllerMessage(nopMsg.getId()), nopMsg);
+      }
+
+      if (_manager.getInstanceType() == InstanceType.PARTICIPANT
+          || _manager.getInstanceType() == InstanceType.CONTROLLER_PARTICIPANT) {
+        nopMsg.setTgtName(_manager.getInstanceName());
+        accessor.setProperty(keyBuilder.message(nopMsg.getTgtName(), nopMsg.getId()), nopMsg);
       }
+    } catch (Exception e) {
+      _logger.error(e);
     }
   }
 


Mime
View raw message