diff --git a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/simultaneous/ConcurrentReadFetchJoinWithUOWLocksTest.java b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/simultaneous/ConcurrentReadFetchJoinWithUOWLocksTest.java index 32b718a7934..8449a026186 100644 --- a/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/simultaneous/ConcurrentReadFetchJoinWithUOWLocksTest.java +++ b/foundation/eclipselink.core.test/src/it/java/org/eclipse/persistence/testing/tests/simultaneous/ConcurrentReadFetchJoinWithUOWLocksTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -72,7 +72,7 @@ public void test(){ clonedPerson.setHobby(clonedProject); uow.writeChanges(); - Thread thread1 = new Thread(new ProjectReader(server.acquireClientSession(), project.getId())); + Thread thread1 = new Thread(new ProjectReader(server.acquireClientSession(), project.getId()), "Test Thread 1"); ConcurrentProject.RUNNING_TEST = ConcurrentProject.READ_WITH_UOW_LOCKS_TESTS; //start reading Project, and have the thread wait while building DTF mappings thread1.start(); @@ -84,7 +84,7 @@ public void test(){ //start uow commit, which will get locks on Person+Address, commit, then merge. //merge should get a deferred lock on Project. - Thread thread2 = new Thread(new UOWCommit(uow)); + Thread thread2 = new Thread(new UOWCommit(uow), "Test Thread 2"); thread2.start(); //while waiting, thread1 should wake and try to get a lock on Address. It will deadlock if it @@ -112,7 +112,9 @@ public void verify(){ } @Override - public void reset(){ + public void reset() throws InterruptedException { + //To give threads from the test() chance to finish + Thread.sleep(1000); ConcurrentProject.RUNNING_TEST = ConcurrentProject.NONE; UnitOfWork uow = getSession().acquireUnitOfWork();