mirror of https://github.com/apache/openjpa.git
OPENJPA-891 - Fix problematic thread test case synchronization problem.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@749135 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f3d1704863
commit
a95c0f0f89
|
@ -392,6 +392,13 @@ public abstract class LockManagerTestBase extends SQLListenerTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
private void notifyParent() {
|
||||
getLog().trace("notifyParent:");
|
||||
synchronized(this) {
|
||||
notify();
|
||||
}
|
||||
}
|
||||
|
||||
public void concurrentLockingTest(
|
||||
int id,
|
||||
int expectedVersionIncrement,
|
||||
|
@ -486,7 +493,10 @@ public abstract class LockManagerTestBase extends SQLListenerTestCase {
|
|||
} else {
|
||||
t2.start();
|
||||
}
|
||||
Thread.sleep(500);
|
||||
log.trace("wait on thread 1");
|
||||
synchronized (this){
|
||||
wait();
|
||||
}
|
||||
if (thread2Run == ThreadToRunFirst.RunThread2) {
|
||||
t1.start();
|
||||
} else {
|
||||
|
@ -710,7 +720,8 @@ public abstract class LockManagerTestBase extends SQLListenerTestCase {
|
|||
log.trace(beforeWaitMethod + ": duration 1="
|
||||
+ (System.currentTimeMillis() - startTimeStamp));
|
||||
log.trace(beforeWaitMethod + ": returns=" + e1);
|
||||
log.trace("wait()");
|
||||
notifyParent();
|
||||
log.trace("childWait()");
|
||||
wait();
|
||||
switch (beforeWaitMethod) {
|
||||
case NoOp:
|
||||
|
|
Loading…
Reference in New Issue