mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Removed concurrency lock methods from LockStore and implementations (ALF-20031)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@56052 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -154,46 +154,4 @@ public abstract class AbstractLockStoreTestBase<T extends LockStore>
|
||||
assertEquals(nodeRef3, it.next());
|
||||
assertEquals(nodeRef4, it.next());
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void whenTryLockFailsTransactionWillRetry() throws InterruptedException
|
||||
{
|
||||
final NodeRef nodeRef = new NodeRef("workspace://SpacesStore/whenTryLockFailsTransactionWillRetry");
|
||||
|
||||
// The "other" thread, that got there first and took the lock.
|
||||
Thread thread = new Thread(getClass().getSimpleName()+"-testTryLock")
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Deliberately NOT releasing this lock, so we can check for tryLock failure.
|
||||
lockStore.acquireConcurrencyLock(nodeRef);
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
// This shouldn't happen the first time.
|
||||
fail("Failed to a acquire lock");
|
||||
}
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
|
||||
|
||||
// Wait for the other thread to perform the lock.
|
||||
thread.join();
|
||||
|
||||
// Second attempt will fail (already locked above), expected exception
|
||||
// must be thrown for retrying behaviour to work correctly.
|
||||
try
|
||||
{
|
||||
lockStore.acquireConcurrencyLock(nodeRef);
|
||||
fail("Exception was not thrown when unable to acquire lock.");
|
||||
}
|
||||
catch (LockTryException e)
|
||||
{
|
||||
// Good, we got the correct exception.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user