Code Review
/
nonrtric.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Remove code smells in PolicyController
[nonrtric.git]
/
policy-agent
/
src
/
main
/
java
/
org
/
oransc
/
policyagent
/
repository
/
Service.java
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
81ef7ff
..
f0863a5
100644
(file)
--- 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,22
+23,22
@@
package org.oransc.policyagent.repository;
import java.time.Duration;
import java.time.Instant;
import java.time.Duration;
import java.time.Instant;
+import lombok.Getter;
+
public class Service {
public class Service {
+ @Getter
private final String name;
private final Duration keepAliveInterval;
private Instant lastPing;
private final String name;
private final Duration keepAliveInterval;
private Instant lastPing;
- // private final String callbackUrl1; // TBD
+ private final String callbackUrl;
- public Service(String name, Duration keepAliveInterval) {
+ public Service(String name, Duration keepAliveInterval
, String callbackUrl
) {
this.name = name;
this.keepAliveInterval = keepAliveInterval;
this.name = name;
this.keepAliveInterval = keepAliveInterval;
+ this.callbackUrl = callbackUrl;
ping();
}
ping();
}
- public synchronized String getName() {
- return this.name;
- }
-
public synchronized Duration getKeepAliveInterval() {
return this.keepAliveInterval;
}
public synchronized Duration getKeepAliveInterval() {
return this.keepAliveInterval;
}
@@
-48,11
+48,15
@@
public class Service {
}
public synchronized boolean isExpired() {
}
public synchronized boolean isExpired() {
- return timeSinceLastPing().compareTo(this.keepAliveInterval) > 0;
+ return t
his.keepAliveInterval.getSeconds() > 0 && t
imeSinceLastPing().compareTo(this.keepAliveInterval) > 0;
}
public synchronized Duration timeSinceLastPing() {
return Duration.between(this.lastPing, Instant.now());
}
}
public synchronized Duration timeSinceLastPing() {
return Duration.between(this.lastPing, Instant.now());
}
+ public synchronized String getCallbackUrl() {
+ return this.callbackUrl;
+ }
+
}
}