FINERACT-2326: EclipseLink sometimes fails if JPQL cache is not warm up but concurrent queries are executed
This commit is contained in:
+13
-7
@@ -124,14 +124,18 @@ public class CobPartitioningTest extends BaseLoanIntegrationTest {
|
|||||||
List<Integer> loanIds = new CopyOnWriteArrayList<>();
|
List<Integer> loanIds = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
// Let's create 1, 2, ..., N-1, N loans
|
// Let's create 1, 2, ..., N-1, N loans
|
||||||
final CountDownLatch createLatch = new CountDownLatch(N);
|
final CountDownLatch createLatch = new CountDownLatch(N - 1);
|
||||||
Integer loanProductID = createLoanProduct();
|
Integer loanProductID = createLoanProduct();
|
||||||
List<Future<?>> futures = new ArrayList<>();
|
List<Future<?>> futures = new ArrayList<>();
|
||||||
for (int i = 0; i < N; i++) {
|
// Warm up (EclipseLink sometimes fails if JPQL cache is not warm up but concurrent queries are executed)
|
||||||
|
Integer clientID = createClient();
|
||||||
|
Integer loanID = createLoanForClient(clientID, loanProductID);
|
||||||
|
loanIds.add(loanID);
|
||||||
|
for (int i = 1; i < N; i++) {
|
||||||
futures.add(executorService.submit(() -> {
|
futures.add(executorService.submit(() -> {
|
||||||
Integer clientID = createClient();
|
Integer internalClientID = createClient();
|
||||||
Integer loanID = createLoanForClient(clientID, loanProductID);
|
Integer internalLoanID = createLoanForClient(internalClientID, loanProductID);
|
||||||
loanIds.add(loanID);
|
loanIds.add(internalLoanID);
|
||||||
createLatch.countDown();
|
createLatch.countDown();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -140,8 +144,10 @@ public class CobPartitioningTest extends BaseLoanIntegrationTest {
|
|||||||
|
|
||||||
// Force close loans 3, 4, ... , N-3, N-2
|
// Force close loans 3, 4, ... , N-3, N-2
|
||||||
Collections.sort(loanIds);
|
Collections.sort(loanIds);
|
||||||
final CountDownLatch closeLatch = new CountDownLatch(N - 4);
|
final CountDownLatch closeLatch = new CountDownLatch(N - 5);
|
||||||
for (int i = 2; i < N - 2; i++) {
|
// Warm up (EclipseLink sometimes fails if JPQL cache is not warm up but concurrent queries are executed)
|
||||||
|
LOAN_TRANSACTION_HELPER.forecloseLoan("02 March 2020", loanIds.get(2));
|
||||||
|
for (int i = 3; i < N - 2; i++) {
|
||||||
final int idx = i;
|
final int idx = i;
|
||||||
futures.add(executorService.submit(() -> {
|
futures.add(executorService.submit(() -> {
|
||||||
LOAN_TRANSACTION_HELPER.forecloseLoan("02 March 2020", loanIds.get(idx));
|
LOAN_TRANSACTION_HELPER.forecloseLoan("02 March 2020", loanIds.get(idx));
|
||||||
|
|||||||
Reference in New Issue
Block a user