FINERACT-2191: ThreadLocal context handling during job execution
This commit is contained in:
committed by
Adam Saghy
parent
0f1d53cbdc
commit
e584e26c39
+8
-3
@@ -41,9 +41,12 @@ public class RecalculateInterestPoster implements Callable<Void> {
|
||||
|
||||
@Override
|
||||
public Void call() throws JobExecutionException {
|
||||
ThreadLocalContextUtil.init(fineractContext);
|
||||
if (!loanIds.isEmpty()) {
|
||||
List<Throwable> errors = new ArrayList<>();
|
||||
if (loanIds.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
ThreadLocalContextUtil.init(fineractContext);
|
||||
final List<Throwable> errors = new ArrayList<>();
|
||||
for (Long loanId : loanIds) {
|
||||
log.debug("Loan ID {}", loanId);
|
||||
try {
|
||||
@@ -55,6 +58,8 @@ public class RecalculateInterestPoster implements Callable<Void> {
|
||||
if (!errors.isEmpty()) {
|
||||
throw new JobExecutionException(errors);
|
||||
}
|
||||
} finally {
|
||||
ThreadLocalContextUtil.reset();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user