mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
69946: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud) 69860: MNT-11371: Alfresco unable to bootstrap due to LockTryExceptions following an upgrade from 3.4.8 -> 3.4.13 -> 4.0.2 to either 4.1.8 or 4.2.1 Merged 4.1.N to V4.2.N (4.2.3) 69848: MNT-11371: Alfresco unable to bootstrap due to LockTryExceptions following an upgrade from 3.4.8 -> 3.4.13 -> 4.0.2 to either 4.1.8 or 4.2.1 Ability to configure try lock timeout for several different contexts has been implemented. New configuration for every context has been added: - system.lockTryTimeout=100 - system.lockTryTimeout.DictionaryDAOImpl=2000 - system.lockTryTimeout.MessageServiceImpl=${system.lockTryTimeout} - system.lockTryTimeout.PolicyComponentImpl=${system.lockTryTimeout} 'LockHelper.tryLock()' has been modified to accept additional string 'useCase' parameter. Parameter is used for throwing exceptions with contextual messages when lock is not acquired 69858: MNT-11371: Alfresco unable to bootstrap due to LockTryExceptions following an upgrade from 3.4.8 -> 3.4.13 -> 4.0.2 to either 4.1.8 or 4.2.1 Additional boolean parameter 'haveWriteLock' has been added to 'MessageServiceImpl.getResourceBundleBaseNames()' method. It serves to avoid unlocking external write locks. The method still assumes that read lock is acquired if 'haveWriteLock=false'. Read lock will be upgraded to write lock only if 'haveWriteLock' parameter is equal to false git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@70462 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -59,7 +59,16 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
private Map<B, Collection<P>> listCache = new HashMap<B, Collection<P>>();
|
||||
|
||||
|
||||
// Try lock timeout (MNT-11371)
|
||||
private long tryLockTimeout;
|
||||
|
||||
|
||||
public void setTryLockTimeout(long tryLockTimeout)
|
||||
{
|
||||
this.tryLockTimeout = tryLockTimeout;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct cached policy factory
|
||||
*
|
||||
@@ -93,7 +102,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
return super.create(binding);
|
||||
}
|
||||
|
||||
LockHelper.tryLock(lock.readLock(), 100);
|
||||
LockHelper.tryLock(lock.readLock(), tryLockTimeout, "getting policy from cache in 'CachedPolicyFactory.create()'");
|
||||
try
|
||||
{
|
||||
P policyInterface = singleCache.get(binding);
|
||||
@@ -108,7 +117,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
}
|
||||
|
||||
// There wasn't one
|
||||
LockHelper.tryLock(lock.writeLock(), 100);
|
||||
LockHelper.tryLock(lock.writeLock(), tryLockTimeout, "putting new policy to cache in 'CachedPolicyFactory.create()'");
|
||||
try
|
||||
{
|
||||
P policyInterface = singleCache.get(binding);
|
||||
@@ -140,7 +149,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
return super.createList(binding);
|
||||
}
|
||||
|
||||
LockHelper.tryLock(lock.readLock(), 100);
|
||||
LockHelper.tryLock(lock.readLock(), tryLockTimeout, "getting policy list from cache in 'CachedPolicyFactory.createList()'");
|
||||
try
|
||||
{
|
||||
Collection<P> policyInterfaces = listCache.get(binding);
|
||||
@@ -155,7 +164,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
}
|
||||
|
||||
// There wasn't one
|
||||
LockHelper.tryLock(lock.writeLock(), 100);
|
||||
LockHelper.tryLock(lock.writeLock(), tryLockTimeout, "putting policy list to cache in 'CachedPolicyFactory.createList()'");
|
||||
try
|
||||
{
|
||||
Collection<P> policyInterfaces = listCache.get(binding);
|
||||
@@ -188,7 +197,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
{
|
||||
if (binding == null)
|
||||
{
|
||||
LockHelper.tryLock(lock.writeLock(), 100);
|
||||
LockHelper.tryLock(lock.writeLock(), tryLockTimeout, "clearing policy cache in 'CachedPolicyFactory.clearCache()'");
|
||||
try
|
||||
{
|
||||
// A specific binding has not been provided, so clear all entries
|
||||
@@ -226,7 +235,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
// Remove all invalid bindings
|
||||
if (invalidBindings.size() > 0)
|
||||
{
|
||||
LockHelper.tryLock(lock.writeLock(), 100);
|
||||
LockHelper.tryLock(lock.writeLock(), tryLockTimeout, "removing invalid policy bindings from cache in 'CachedPolicyFactory.clearCache()'");
|
||||
try
|
||||
{
|
||||
for (B invalidBinding : invalidBindings)
|
||||
|
Reference in New Issue
Block a user