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:
Alan Davis
2014-05-16 20:06:48 +00:00
parent dab8858288
commit c505322c35
10 changed files with 104 additions and 45 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -73,7 +73,15 @@ public class PolicyComponentImpl implements PolicyComponent
// Wild Card Feature
private static final QName FEATURE_WILDCARD = QName.createQName(NamespaceService.DEFAULT_URI, "*");
// Try lock timeout (MNT-11371)
private long tryLockTimeout;
public void setTryLockTimeout(long tryLockTimeout)
{
this.tryLockTimeout = tryLockTimeout;
}
/**
* Construct
@@ -129,7 +137,8 @@ public class PolicyComponentImpl implements PolicyComponent
ParameterCheck.mandatory("Policy interface class", policy);
PolicyDefinition definition = createPolicyDefinition(policy);
registeredPolicies.put(new PolicyKey(definition.getType(), definition.getName()), definition);
ClassPolicyDelegate<P> delegate = new ClassPolicyDelegate<P>(dictionary, policy, getClassBehaviourIndex(definition.getName()));
ClassPolicyDelegate<P> delegate = new ClassPolicyDelegate<P>(dictionary, policy, getClassBehaviourIndex(definition.getName()), tryLockTimeout);
if (logger.isInfoEnabled())
logger.info("Registered class policy " + definition.getName() + " (" + definition.getPolicyInterface() + ")");
@@ -152,7 +161,7 @@ public class PolicyComponentImpl implements PolicyComponent
ParameterCheck.mandatory("Policy interface class", policy);
PolicyDefinition definition = createPolicyDefinition(policy);
registeredPolicies.put(new PolicyKey(definition.getType(), definition.getName()), definition);
PropertyPolicyDelegate<P> delegate = new PropertyPolicyDelegate<P>(dictionary, policy, getPropertyBehaviourIndex(definition.getName()));
PropertyPolicyDelegate<P> delegate = new PropertyPolicyDelegate<P>(dictionary, policy, getPropertyBehaviourIndex(definition.getName()), tryLockTimeout);
if (logger.isInfoEnabled())
logger.info("Registered property policy " + definition.getName() + " (" + definition.getPolicyInterface() + ")");
@@ -170,7 +179,7 @@ public class PolicyComponentImpl implements PolicyComponent
ParameterCheck.mandatory("Policy interface class", policy);
PolicyDefinition definition = createPolicyDefinition(policy);
registeredPolicies.put(new PolicyKey(definition.getType(), definition.getName()), definition);
AssociationPolicyDelegate<P> delegate = new AssociationPolicyDelegate<P>(dictionary, policy, getAssociationBehaviourIndex(definition.getName()));
AssociationPolicyDelegate<P> delegate = new AssociationPolicyDelegate<P>(dictionary, policy, getAssociationBehaviourIndex(definition.getName()), tryLockTimeout);
if (logger.isInfoEnabled())
logger.info("Registered association policy " + definition.getName() + " (" + definition.getPolicyInterface() + ")");
@@ -431,6 +440,7 @@ public class PolicyComponentImpl implements PolicyComponent
if (index == null)
{
index = new ClassBehaviourIndex<ClassBehaviourBinding>(behaviourFilter);
index.setTryLockTimeout(tryLockTimeout);
classBehaviours.put(policy, index);
}
return index;
@@ -449,6 +459,7 @@ public class PolicyComponentImpl implements PolicyComponent
if (index == null)
{
index = new ClassBehaviourIndex<ClassFeatureBehaviourBinding>(behaviourFilter);
index.setTryLockTimeout(tryLockTimeout);
propertyBehaviours.put(policy, index);
}
return index;
@@ -467,6 +478,7 @@ public class PolicyComponentImpl implements PolicyComponent
if (index == null)
{
index = new ClassBehaviourIndex<ClassFeatureBehaviourBinding>(behaviourFilter);
index.setTryLockTimeout(tryLockTimeout);
associationBehaviours.put(policy, index);
}
return index;