You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "galovics (via GitHub)" <gi...@apache.org> on 2023/03/28 12:45:13 UTC
[GitHub] [fineract] galovics commented on a diff in pull request #3080: FINERACT-1724: Optimizing the account locking for Loan COB
galovics commented on code in PR #3080:
URL: https://github.com/apache/fineract/pull/3080#discussion_r1150550940
##########
fineract-provider/src/main/java/org/apache/fineract/cob/loan/FetchAndLockLoanTasklet.java:
##########
@@ -87,10 +92,21 @@ public RepeatStatus execute(@NotNull StepContribution contribution, @NotNull Chu
return RepeatStatus.FINISHED;
}
- private void applySoftLock(List<Long> alreadySoftLockedAccounts) {
- for (Long loanId : alreadySoftLockedAccounts) {
- LoanAccountLock loanAccountLock = new LoanAccountLock(loanId, LockOwner.LOAN_COB_PARTITIONING);
- loanAccountLockRepository.save(loanAccountLock);
- }
+ private void applySoftLock(List<Long> accountsToLock) {
+ LocalDate cobBusinessDate = ThreadLocalContextUtil.getBusinessDateByType(BusinessDateType.COB_DATE);
+ jdbcTemplate.batchUpdate("""
+ INSERT INTO m_loan_account_locks (loan_id, version, lock_owner, lock_placed_on, lock_placed_on_cob_business_date)
+ VALUES (?, ?, ?, ?, ?)
+ """, accountsToLock, getInClauseParameterSizeLimit(), (ps, id) -> {
Review Comment:
With that approach, you can't do JDBC level batching. This is the only way to do so.
--
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org