somasorosdpc commented on code in PR #4032:
URL: https://github.com/apache/fineract/pull/4032#discussion_r1731610952


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/RecalculateInterestPoster.java:
##########
@@ -22,27 +22,26 @@
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.Callable;
-import lombok.NoArgsConstructor;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.fineract.infrastructure.core.domain.FineractContext;
+import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
 import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
 
-@NoArgsConstructor
+@RequiredArgsConstructor
 @Slf4j
 public class RecalculateInterestPoster implements Callable<Void> {
 
+    @Setter
     private Collection<Long> loanIds;
-    private LoanWritePlatformService loanWritePlatformService;
-
-    public void setLoanIds(final Collection<Long> loanIds) {
-        this.loanIds = loanIds;
-    }
-
-    public void setLoanWritePlatformService(final LoanWritePlatformService 
loanWritePlatformService) {
-        this.loanWritePlatformService = loanWritePlatformService;
-    }
+    @Setter
+    private FineractContext fineractContext;
+    private final LoanWritePlatformService loanWritePlatformService;
 
     @Override
     public Void call() throws JobExecutionException {
+        ThreadLocalContextUtil.init(fineractContext);

Review Comment:
   This is necessary to work correctly. new/ol threads may have no or wrong 
context.



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