You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2017/05/23 19:11:00 UTC

[2/2] helix git commit: Minor improvement for batch message test

Minor improvement for batch message test


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

Branch: refs/heads/helix-0.6.x
Commit: f8bb57d972886a15a4b694e675c74c0f07ea56cc
Parents: 83ca304
Author: Junkai Xue <jx...@linkedin.com>
Authored: Tue May 16 15:42:59 2017 -0700
Committer: Junkai Xue <jx...@linkedin.com>
Committed: Mon May 22 18:44:35 2017 -0700

----------------------------------------------------------------------
 .../helix/integration/TestBatchMessageHandling.java     | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/f8bb57d9/helix-core/src/test/java/org/apache/helix/integration/TestBatchMessageHandling.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestBatchMessageHandling.java b/helix-core/src/test/java/org/apache/helix/integration/TestBatchMessageHandling.java
index 1d7ac5e..660c14c 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestBatchMessageHandling.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestBatchMessageHandling.java
@@ -86,13 +86,15 @@ public class TestBatchMessageHandling extends ZkStandAloneCMTestBase {
 
   public static class TestOnlineOfflineStateModel extends StateModel {
     private static Logger LOG = Logger.getLogger(MockMSStateModel.class);
-    public static int _numOfSuccessBeforeFail;
+    public static Integer _numOfSuccessBeforeFail;
 
-    public synchronized void onBecomeOnlineFromOffline(Message message,
+    public void onBecomeOnlineFromOffline(Message message,
         NotificationContext context) {
-      if (_numOfSuccessBeforeFail-- > 0) {
-        LOG.info("State transition from Offline to Online");
-        return;
+      synchronized (_numOfSuccessBeforeFail) {
+        if (_numOfSuccessBeforeFail-- > 0) {
+          LOG.info("State transition from Offline to Online");
+          return;
+        }
       }
       throw new HelixException("Number of Success reached");
     }