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=f0863a5ee7e44f709f47da111f612ee2540def6a;hb=b66dcce5210e25b2571036becb6f0e7b0c23e1b2;hp=6458dbbafdcad21fb05a61789727fedbd4d2a441;hpb=7a4a590fb0ebf8772169625cdda327da43c79c6d;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 6458dbba..f0863a5e 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 @@ -23,7 +23,10 @@ package org.oransc.policyagent.repository; import java.time.Duration; import java.time.Instant; +import lombok.Getter; + public class Service { + @Getter private final String name; private final Duration keepAliveInterval; private Instant lastPing; @@ -36,10 +39,6 @@ public class Service { ping(); } - public synchronized String getName() { - return this.name; - } - public synchronized Duration getKeepAliveInterval() { return this.keepAliveInterval; } @@ -49,7 +48,7 @@ public class Service { } public synchronized boolean isExpired() { - return timeSinceLastPing().compareTo(this.keepAliveInterval) > 0; + return this.keepAliveInterval.getSeconds() > 0 && timeSinceLastPing().compareTo(this.keepAliveInterval) > 0; } public synchronized Duration timeSinceLastPing() {