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:
Albert Lee 2009-03-01 22:15:02 +00:00
parent f3d1704863
commit a95c0f0f89
1 changed files with 13 additions and 2 deletions

View File

@ -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: