Murtadha Hubail has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/2569

Change subject: [NO ISSUE][CLUSTER] Poll CC Registration Response
......................................................................

[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
---
M 
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/CcConnection.java
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/69/2569/1

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..1e936de 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,11 @@
         registrationPending = true;
         ccs.registerNode(nodeRegistration, registrationId);
         try {
-            InvokeUtil.runWithTimeout(this::wait, () -> !registrationPending, 
2, TimeUnit.MINUTES);
+            InvokeUtil.runWithTimeout(() -> {
+                synchronized (this) {
+                    this.wait(REGISTRATION_RESPONSE_POLL_PERIOD); // NOSONAR 
while loop in timeout
+                }
+            }, () -> !registrationPending, 1, TimeUnit.NANOSECONDS);
         } catch (Exception e) {
             registrationException = e;
         }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2569
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e2d5ea0ef315d90784a58ee2748a422812b4a2f
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: release-0.9.4-pre-rc
Gerrit-Owner: Murtadha Hubail <mhub...@apache.org>

Reply via email to