Skip to content

Commit

Permalink
Added braces and log message to HeartBeater
Browse files Browse the repository at this point in the history
  • Loading branch information
hierynomus committed Jan 16, 2015
1 parent 703a0df commit a7872b3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/java/net/schmizz/sshj/transport/Heartbeater.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -47,14 +48,15 @@ synchronized int getInterval() {

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();
Expand All @@ -67,11 +69,12 @@ public void run() {
} 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");
}

}

0 comments on commit a7872b3

Please sign in to comment.