nwangtw commented on a change in pull request #3299: Retry tunnel setup when it 
fails
URL: https://github.com/apache/incubator-heron/pull/3299#discussion_r296974708
 
 

 ##########
 File path: 
heron/statemgrs/src/java/org/apache/heron/statemgr/zookeeper/curator/CuratorStateManager.java
 ##########
 @@ -83,17 +84,24 @@ public void initialize(Config newConfig) {
         NetworkUtils.TunnelConfig.build(config, 
NetworkUtils.HeronSystem.STATE_MANAGER);
 
     if (tunnelConfig.isTunnelNeeded()) {
-      Pair<String, List<Process>> tunneledResults = 
setupZkTunnel(tunnelConfig);
+      for (int setupCount = 0;; ++setupCount) {
+        Pair<String, List<Process>> tunneledResults = 
setupZkTunnel(tunnelConfig);
+        String newConnectionString = tunneledResults.first;
+
+        // If tunnel can't be setup correctly. Retry or bail.
+        if (newConnectionString.isEmpty()) {
+          if (setupCount < TUNNEL_SETUP_RETRY) {
+            continue;  // Retry
 
 Review comment:
   make sense. thx.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to