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


##########
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:
   Thanks @tkobayas 
   I thought it was something like that, but in cases like that, usually, 
everything is written only inside the `synchronized` block: TBH it is the first 
time I see that "pattern": am I clear ? Does this make sense ?
   Anyway, just a minor detail 



-- 
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