[NO ISSUE][NET] Preemptively re-resolve INetSocketAddresses when replica connection is unhealthy

Change-Id: I64386b9a1e63d2b2ab792628dc4348a30590cc6f
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/5043
Reviewed-by: Michael Blow <mblow@apache.org>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/PartitionReplica.java b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/PartitionReplica.java
index f2d2496..3226299 100644
--- a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/PartitionReplica.java
+++ b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/PartitionReplica.java
@@ -106,12 +106,9 @@
     }
 
     private void establishReplicaConnection() throws IOException {
-        try {
-            sc = ReplicationProtocol.establishReplicaConnection(appCtx, id.getLocation());
-        } catch (Exception e) {
-            // try to re-resolve the address, in case our replica has had his IP address updated
-            sc = ReplicationProtocol.establishReplicaConnection(appCtx, id.refreshLocation());
-        }
+        // try to re-resolve the address, in case our replica has had his IP address updated, and that is why the
+        // connection is unhealthy...
+        sc = ReplicationProtocol.establishReplicaConnection(appCtx, id.refreshLocation());
     }
 
     public synchronized void close() {
diff --git a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/ReplicationDestination.java b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/ReplicationDestination.java
index 782a801..d803756 100644
--- a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/ReplicationDestination.java
+++ b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/api/ReplicationDestination.java
@@ -94,13 +94,10 @@
     }
 
     protected void establishReplicaConnection(INcApplicationContext appCtx) throws IOException {
-        try {
-            logRepChannel = ReplicationProtocol.establishReplicaConnection(appCtx, resolvedLocation);
-        } catch (Exception e) {
-            // try to re-resolve the address, in case our replica has had his IP address updated
-            resolvedLocation = NetworkUtil.refresh(resolvedLocation);
-            logRepChannel = ReplicationProtocol.establishReplicaConnection(appCtx, resolvedLocation);
-        }
+        // try to re-resolve the address, in case our replica has had his IP address updated, and that is why
+        // the connection is unhealthy...
+        resolvedLocation = NetworkUtil.refresh(resolvedLocation);
+        logRepChannel = ReplicationProtocol.establishReplicaConnection(appCtx, resolvedLocation);
     }
 
     private synchronized void closeLogReplicationChannel() {