JobLockService implementation

- Provides transaction-aware locking
 - Post-transaction cleanup is automatically done
 - Retrying for lock acquisition is handled internally as well
 - Downgraded the lock concurrency tests for the build machine (maybe 50 threads was too much)
 - Deadlock tests added for the high-level locking


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13968 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-04-15 19:16:38 +00:00
parent 5bda334c22
commit 389f996f29
12 changed files with 863 additions and 10 deletions

View File

@@ -30,6 +30,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
/**
* Helper class that will look up or create transactional resources.
@@ -77,6 +78,24 @@ public abstract class TransactionalResourceHelper
return set;
}
/**
* Support method to retrieve or create and bind a <tt>TreeSet</tt> to the current transaction.
*
* @param <V> the set value type
* @param resourceKey the key under which the resource will be stored
* @return Returns an previously-bound <tt>TreeSet</tt> or else a newly-bound <tt>TreeSet</tt>
*/
public static final <V> TreeSet<V> getTreeSet(Object resourceKey)
{
TreeSet<V> set = AlfrescoTransactionSupport.<TreeSet<V>>getResource(resourceKey);
if (set == null)
{
set = new TreeSet<V>();
AlfrescoTransactionSupport.bindResource(resourceKey, set);
}
return set;
}
/**
* Support method to retrieve or create and bind a <tt>ArrayList</tt> to the current transaction.
*