this.name = name;
this.keepAliveInterval = keepAliveInterval;
this.callbackUrl = callbackUrl;
- ping();
+ keepAlive();
}
public synchronized Duration getKeepAliveInterval() {
return this.keepAliveInterval;
}
- private synchronized void ping() {
+ public synchronized void keepAlive() {
this.lastPing = Instant.now();
}
public synchronized boolean isExpired() {
- return timeSinceLastPing().compareTo(this.keepAliveInterval) > 0;
+ return this.keepAliveInterval.getSeconds() > 0 && timeSinceLastPing().compareTo(this.keepAliveInterval) > 0;
}
public synchronized Duration timeSinceLastPing() {