budaidev commented on code in PR #4861:
URL: https://github.com/apache/fineract/pull/4861#discussion_r2211494409


##########
fineract-core/src/main/java/org/apache/fineract/organisation/monetary/domain/MoneyHelper.java:
##########
@@ -22,17 +22,20 @@
 import jakarta.annotation.PostConstruct;
 import java.math.MathContext;
 import java.math.RoundingMode;
+import java.util.concurrent.ConcurrentHashMap;
 import lombok.extern.slf4j.Slf4j;
 import 
org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
+import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
+import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Slf4j
 @Component
 public class MoneyHelper {
 
-    private static RoundingMode roundingMode = null;
-    private static MathContext mathContext;
+    private static final ConcurrentHashMap<String, RoundingMode> 
roundingModeCache = new ConcurrentHashMap<>();
+    private static final ConcurrentHashMap<String, MathContext> 
mathContextCache = new ConcurrentHashMap<>();
     public static final int PRECISION = 19;
 
     private static ConfigurationDomainService staticConfigurationDomainService;

Review Comment:
   Agreed, I think a validation could be useful for that use case. Changing the 
rounding would cause troubles for previous calculation consistency
   



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

Reply via email to