Fix potential risk of race condition

Issue-ID: NONRTRIC-245
Signed-off-by: ecaiyanlinux <martin.c.yan@est.tech>
Change-Id: I54f9e8eeaf47e4c06c486e9f988896253471f8bc
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/repository/Services.java b/policy-agent/src/main/java/org/oransc/policyagent/repository/Services.java
index 1fd08a8..1c0e15a 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/repository/Services.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/repository/Services.java
@@ -63,7 +63,7 @@
         return registeredServices.size();
     }
 
-    public void clear() {
+    public synchronized void clear() {
         registeredServices.clear();
     }
 }