[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 <mblow@apache.org>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
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 @@
 
 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 @@
         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;
         }