[NO ISSUE][CLUSTER] Poll CC Registration Response

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Check for CC registration response while waiting
  to avoid waiting forever.

Change-Id: I6e2d5ea0ef315d90784a58ee2748a422812b4a2f
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2569
Reviewed-by: Michael Blow <mb...@apache.org>
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>


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

Branch: refs/heads/master
Commit: 29a0cee0092f80676a93e005c9099af19bcf7db1
Parents: da479dc
Author: Murtadha Hubail <mhub...@apache.org>
Authored: Thu Apr 5 01:00:41 2018 +0300
Committer: Murtadha Hubail <mhub...@apache.org>
Committed: Wed Apr 4 16:51:15 2018 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/hyracks/control/nc/CcConnection.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/29a0cee0/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/CcConnection.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/CcConnection.java
 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/CcConnection.java
index dce7d35..627e972 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/CcConnection.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/CcConnection.java
@@ -33,6 +33,7 @@ import org.apache.logging.log4j.Logger;
 
 public class CcConnection {
     private static final Logger LOGGER = LogManager.getLogger();
+    private static final long REGISTRATION_RESPONSE_POLL_PERIOD = 
TimeUnit.SECONDS.toMillis(1);
 
     private final IClusterController ccs;
     private boolean registrationPending;
@@ -64,7 +65,9 @@ public class CcConnection {
         registrationPending = true;
         ccs.registerNode(nodeRegistration, registrationId);
         try {
-            InvokeUtil.runWithTimeout(this::wait, () -> !registrationPending, 
2, TimeUnit.MINUTES);
+            InvokeUtil.runWithTimeout(() -> {
+                this.wait(REGISTRATION_RESPONSE_POLL_PERIOD); // NOSONAR while 
loop in timeout call
+            }, () -> !registrationPending, 1, TimeUnit.MINUTES);
         } catch (Exception e) {
             registrationException = e;
         }

Reply via email to