X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Frepository%2FService.java;h=7b2c9bdec6c3d91df281221f485bd11397b16dbf;hb=5408c157fc8aca52731fcc2cc035ed9dbfcff219;hp=bcdc2ee0666aa4aaf79b9ad6fa06958c6a6932c8;hpb=9fb9f6e4fe8eb9425d848ae576c0e755dfca22df;p=nonrtric.git diff --git a/policy-agent/src/main/java/org/oransc/policyagent/repository/Service.java b/policy-agent/src/main/java/org/oransc/policyagent/repository/Service.java index bcdc2ee0..7b2c9bde 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/repository/Service.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/repository/Service.java @@ -36,19 +36,19 @@ public class Service { 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() {