Beefing up testConcurrentLockAquisition

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29273 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-07-22 10:20:32 +00:00
parent 92eefc9b78
commit 3b95ca79da

View File

@@ -326,7 +326,7 @@ public class LockDAOTest extends TestCase
/** /**
* Uses a thread lock to ensure that the lock DAO only allows locks through one at a time. * Uses a thread lock to ensure that the lock DAO only allows locks through one at a time.
*/ */
public synchronized void testConcurrentLockAquisition() throws Exception public synchronized void testConcurrentLockAcquisition() throws Exception
{ {
ReentrantLock threadLock = new ReentrantLock(); ReentrantLock threadLock = new ReentrantLock();
GetLockThread[] threads = new GetLockThread[5]; GetLockThread[] threads = new GetLockThread[5];
@@ -338,12 +338,12 @@ public class LockDAOTest extends TestCase
// Wait a bit and see if any encountered errors // Wait a bit and see if any encountered errors
boolean allDone = false; boolean allDone = false;
waitLoop: waitLoop:
for (int waitLoop = 0; waitLoop < 50; waitLoop++) for (int waitLoop = 0; waitLoop < 500; waitLoop++)
{ {
wait(1000L); wait(1000L);
for (int i = 0; i < threads.length; i++) for (int i = 0; i < threads.length; i++)
{ {
if (!threads[i].done) if (!threads[i].isDone())
{ {
continue waitLoop; continue waitLoop;
} }
@@ -429,5 +429,9 @@ public class LockDAOTest extends TestCase
} }
} }
} }
public synchronized boolean isDone()
{
return done;
}
} }
} }