This is an automated email from the ASF dual-hosted git repository.

jkevan pushed a commit to branch json-schema-extensions
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/json-schema-extensions by this 
push:
     new 7666725db code review adjustments
7666725db is described below

commit 7666725db3932bf5adcbc458d394aaca253692ed
Author: Kevan <[email protected]>
AuthorDate: Mon May 23 17:23:46 2022 +0200

    code review adjustments
---
 .../java/org/apache/unomi/schema/impl/SchemaServiceImpl.java   | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git 
a/extensions/json-schema/services/src/main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java
 
b/extensions/json-schema/services/src/main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java
index a1c0a50ba..44d3850c8 100644
--- 
a/extensions/json-schema/services/src/main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java
+++ 
b/extensions/json-schema/services/src/main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java
@@ -55,11 +55,11 @@ public class SchemaServiceImpl implements SchemaService {
     /**
      * All Unomi schemas indexed by URI
      */
-    private final ConcurrentMap<String, JsonSchemaWrapper> schemasById = new 
ConcurrentHashMap<>();
+    private ConcurrentMap<String, JsonSchemaWrapper> schemasById = new 
ConcurrentHashMap<>();
     /**
      * Available extensions indexed by key:schema URI to be extended, value: 
list of schema extension URIs
      */
-    private final ConcurrentMap<String, Set<String>> extensions = new 
ConcurrentHashMap<>();
+    private ConcurrentMap<String, Set<String>> extensions = new 
ConcurrentHashMap<>();
 
     private Integer jsonSchemaRefreshInterval = 1000;
     private ScheduledFuture<?> scheduledFuture;
@@ -204,8 +204,7 @@ public class SchemaServiceImpl implements SchemaService {
         }
 
         if (changes) {
-            schemasById.clear();
-            schemasById.putAll(schemasByIdReloaded);
+            schemasById = new ConcurrentHashMap<>(schemasByIdReloaded);
 
             initExtensions(schemasByIdReloaded);
             initJsonSchemaFactory();
@@ -233,8 +232,7 @@ public class SchemaServiceImpl implements SchemaService {
             }
         }
 
-        extensions.clear();
-        extensions.putAll(extensionsReloaded);
+        extensions = new ConcurrentHashMap<>(extensionsReloaded);
     }
 
     private String generateExtendedSchema(String id, String schema) throws 
JsonProcessingException {

Reply via email to