Code Review
/
nonrtric.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix potential risk of race condition
[nonrtric.git]
/
policy-agent
/
src
/
main
/
java
/
org
/
oransc
/
policyagent
/
repository
/
Ric.java
diff --git
a/policy-agent/src/main/java/org/oransc/policyagent/repository/Ric.java
b/policy-agent/src/main/java/org/oransc/policyagent/repository/Ric.java
index
c50a0f0
..
fb2e4b9
100644
(file)
--- a/
policy-agent/src/main/java/org/oransc/policyagent/repository/Ric.java
+++ b/
policy-agent/src/main/java/org/oransc/policyagent/repository/Ric.java
@@
-20,7
+20,6
@@
package org.oransc.policyagent.repository;
package org.oransc.policyagent.repository;
-import com.google.common.collect.ImmutableList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@
-33,14
+32,13
@@
import org.oransc.policyagent.clients.A1Client.A1ProtocolType;
import org.oransc.policyagent.configuration.RicConfig;
/**
import org.oransc.policyagent.configuration.RicConfig;
/**
- * Represents the dynamic information about a Near
Realtime-
RIC.
+ * Represents the dynamic information about a Near
-RT
RIC.
*/
public class Ric {
*/
public class Ric {
- private final RicConfig ricConfig;
- private final ImmutableList<String> managedElementIds;
-
- private RicState state = RicState.UNDEFINED;
+ @Setter
+ private RicConfig ricConfig;
+ private RicState state = RicState.UNAVAILABLE;
private Map<String, PolicyType> supportedPolicyTypes = new HashMap<>();
@Getter
@Setter
private Map<String, PolicyType> supportedPolicyTypes = new HashMap<>();
@Getter
@Setter
@@
-56,7
+54,6
@@
public class Ric {
*/
public Ric(RicConfig ricConfig) {
this.ricConfig = ricConfig;
*/
public Ric(RicConfig ricConfig) {
this.ricConfig = ricConfig;
- this.managedElementIds = ricConfig.managedElementIds();
}
public String name() {
}
public String name() {
@@
-81,7
+78,7
@@
public class Ric {
* @return a vector containing the nodes managed by this Ric.
*/
public synchronized Collection<String> getManagedElementIds() {
* @return a vector containing the nodes managed by this Ric.
*/
public synchronized Collection<String> getManagedElementIds() {
- return
managedElementIds
;
+ return
ricConfig.managedElementIds()
;
}
/**
}
/**
@@
-91,7
+88,7
@@
public class Ric {
* @return true if the given node is managed by this Ric.
*/
public synchronized boolean isManaging(String managedElementId) {
* @return true if the given node is managed by this Ric.
*/
public synchronized boolean isManaging(String managedElementId) {
- return
managedElementIds
.contains(managedElementId);
+ return
ricConfig.managedElementIds()
.contains(managedElementId);
}
/**
}
/**
@@
-137,7
+134,7
@@
public class Ric {
@Override
public synchronized String toString() {
return Ric.class.getSimpleName() + ": " + "name: " + name() + ", state: " + state + ", baseUrl: "
@Override
public synchronized String toString() {
return Ric.class.getSimpleName() + ": " + "name: " + name() + ", state: " + state + ", baseUrl: "
- + ricConfig.baseUrl() + ", managedNodes: " +
managedElementIds
;
+ + ricConfig.baseUrl() + ", managedNodes: " +
ricConfig.managedElementIds()
;
}
/**
}
/**
@@
-147,14
+144,19
@@
public class Ric {
/**
* The agent view of the Ric may be inconsistent.
*/
/**
* The agent view of the Ric may be inconsistent.
*/
- UN
DEFINED
,
+ UN
AVAILABLE
,
/**
* The normal state. Policies can be configured.
*/
/**
* The normal state. Policies can be configured.
*/
-
ID
LE,
+
AVAILAB
LE,
/**
* The agent is synchronizing the view of the Ric.
*/
/**
* The agent is synchronizing the view of the Ric.
*/
- SYNCHRONIZING
+ SYNCHRONIZING,
+
+ /**
+ * A consistency check between the agent and the Ric is done
+ */
+ CONSISTENCY_CHECK
}
}
}
}