mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 15:20:54 +03:00
Added braces and log message to HeartBeater
This commit is contained in:
@@ -36,8 +36,9 @@ final class Heartbeater
|
||||
|
||||
synchronized void setInterval(int interval) {
|
||||
this.interval = interval;
|
||||
if (interval > 0 && getState() == Thread.State.NEW)
|
||||
if (interval > 0 && getState() == Thread.State.NEW) {
|
||||
start();
|
||||
}
|
||||
notify();
|
||||
}
|
||||
|
||||
@@ -47,14 +48,15 @@ final class Heartbeater
|
||||
|
||||
synchronized private int getPositiveInterval()
|
||||
throws InterruptedException {
|
||||
while (interval <= 0)
|
||||
while (interval <= 0) {
|
||||
wait();
|
||||
}
|
||||
return interval;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
log.debug("Starting");
|
||||
log.debug("Starting Heartbeat, sending heartbeat every {} seconds", interval);
|
||||
try {
|
||||
while (!isInterrupted()) {
|
||||
final int hi = getPositiveInterval();
|
||||
@@ -67,11 +69,12 @@ final class Heartbeater
|
||||
} catch (Exception e) {
|
||||
if (isInterrupted()) {
|
||||
// We are meant to shut up and draw to a close if interrupted
|
||||
} else
|
||||
} else {
|
||||
trans.die(e);
|
||||
}
|
||||
}
|
||||
|
||||
log.debug("Stopping");
|
||||
log.debug("Stopping Heartbeat");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user