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