Skip to content

Commit 342e010

Browse files
kofemannkhys95
authored andcommitted
cells: always try to re-establish dead tunnel, unless stopped
Motivation: As long as cell tunnel is not explicitly stopped by calling dmg.cells.network.LocationManagerConnector#stopped, other interrupts should be ignored. Modification: Update retry logic to never give up, unless _isRunning flag set to false. Result: More robust tulles in case of network issues. Issue: #7707, #5326 Acked-by: Dmitry Litvintsev Target: master, 10.2, 10.1, 10.0, 9.2 Require-book: no Require-notes: yes (cherry picked from commit 600ed1f) Signed-off-by: Tigran Mkrtchyan <[email protected]>
1 parent 528c0a4 commit 342e010

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

modules/cells/src/main/java/dmg/cells/network/LocationManagerConnector.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ public void run() {
102102
} finally {
103103
getNucleus().kill(tunnel.getCellName());
104104
}
105-
} catch (InterruptedIOException | ClosedByInterruptException e) {
106-
throw e;
105+
} catch (InterruptedIOException | InterruptedException | ClosedByInterruptException e) {
106+
_log.warn("Connection to {} ({}) interrupted. Reason: {}", _domain, _address, e.toString());
107107
} catch (ExecutionException | IOException e) {
108108
String error = Exceptions.meaningfulMessage(Throwables.getRootCause(e));
109109
_log.warn(AlarmMarkerFactory.getMarker(PredefinedAlarm.LOCATION_MANAGER_FAILURE,
@@ -116,11 +116,16 @@ public void run() {
116116
_status = "Sleeping";
117117
long sleep = random.nextInt(16000) + 4000;
118118
_log.warn("Sleeping {} seconds", sleep / 1000);
119-
Thread.sleep(sleep);
119+
try {
120+
Thread.sleep(sleep);
121+
} catch (InterruptedException e) {
122+
// restore interrupted status
123+
Thread.currentThread().interrupt();
124+
}
120125
}
121-
} catch (InterruptedIOException | InterruptedException | ClosedByInterruptException ignored) {
122126
} finally {
123127
NDC.pop();
128+
_thread = null;
124129
_status = "Terminated";
125130
}
126131
}

0 commit comments

Comments
 (0)