tjwatson commented on code in PR #170:
URL: https://github.com/apache/felix-dev/pull/170#discussion_r938933632


##########
configurator/src/main/java/org/apache/felix/configurator/impl/model/State.java:
##########
@@ -39,9 +39,8 @@ public class State extends AbstractState implements 
Serializable {
 
     public static final String FILE_NAME = "state.ser";
 
-    private Map<Long, Long> bundlesLastModified = new HashMap<>();
-
-    private Map<Long, Long> bundlesConfigAdminBundleId = new HashMap<>();
+    private Map<Long, Long> bundlesLastModified = new ConcurrentHashMap<>();

Review Comment:
   The Map type changing is what triggered my comment about serialization.  The 
concern is that a previous data stream would be storing a HashMap instance and 
when you do the read on restoring it will construct a HashMap instance back.  
So in that case you need to read into a Map local instance for the call to 
`Map<Long, Long>) in.readObject();` then check the instance of the Map.  If it 
is not a ConcurrentHashMap then you need to copy the content of the read map 
into a new ConcurrentHashMap instance.
   
   But it seems there is other issues with thread safety for the `private 
volatile Set<String> initialHashes` set.  Is that always set to a 
ConcurrentHashSet or something similar to ensure it is thread safe?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@felix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to