gitgabrio commented on code in PR #6520:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6520#discussion_r2545405396


##########
drools-ruleunits/drools-ruleunits-impl/src/main/java/org/drools/ruleunits/impl/RuleUnitProviderImpl.java:
##########
@@ -66,21 +68,29 @@ public class RuleUnitProviderImpl implements 
RuleUnitProvider {
 
     private static final boolean USE_EXEC_MODEL = true;
 
-    private final Map<String, RuleUnit> ruleUnitMap;
+    private final ConcurrentMap<String, RuleUnit> ruleUnitMap;
+    private final Object generationLock = new Object();
 
     public RuleUnitProviderImpl() {
-        this.ruleUnitMap = 
loadRuleUnits(Thread.currentThread().getContextClassLoader());
+        this.ruleUnitMap = new 
ConcurrentHashMap<>(loadRuleUnits(Thread.currentThread().getContextClassLoader()));
     }
 
     @Override
     public <T extends RuleUnitData> RuleUnit<T> getRuleUnit(T ruleUnitData) {
         String ruleUnitName = getRuleUnitName(ruleUnitData);
-        RuleUnit<T> ruleUnit = ruleUnitMap.get(ruleUnitName);
+        RuleUnit<T> ruleUnit = (RuleUnit<T>) ruleUnitMap.get(ruleUnitName);

Review Comment:
   Hi @tkobayas 
   I saw that modification just by chance, but I'm not sure to understand why 
that -> 
   
   ```
   ruleUnit = (RuleUnit<T>) ruleUnitMap.get(ruleUnitName);
           if (ruleUnit != null) {
               return ruleUnit;
           }
   ```
   
   has to be repeated inside the `synchronized` block, if first retrieval is 
`null`...
    



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to