Package fr.becpg.util
Class MutexFactory
java.lang.Object
fr.becpg.util.MutexFactory
MutexFactory class.
- Version:
- $Id: $Id
- Author:
- matthieu
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.springframework.util.ConcurrentReferenceHashMap<String,MutexFactory.JobLockWrapper> private org.alfresco.repo.lock.JobLockServiceprivate static final Longprivate static final org.apache.commons.logging.Logprivate org.springframework.util.ConcurrentReferenceHashMap<String,ReentrantLock> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetClusterMutex(String key, String lockName) getClusterMutex.getMutex.voidremoveMutex(String key, Object value) removeMutex.
-
Field Details
-
LOCK_TIMEOUT
-
logger
private static final org.apache.commons.logging.Log logger -
memoryMap
-
clusterMap
private org.springframework.util.ConcurrentReferenceHashMap<String,MutexFactory.JobLockWrapper> clusterMap -
jobLockService
@Autowired private org.alfresco.repo.lock.JobLockService jobLockService
-
-
Constructor Details
-
MutexFactory
public MutexFactory()Constructor for MutexFactory.
-
-
Method Details
-
getMutex
getMutex.
Returns a memory-only lock for entity-level synchronization. Use this for entity-specific locks (formulate-{nodeId}) to avoid: - Deadlock in beforeCommit during init-repo - Pollution of alf_lock_resource with dynamic QNames- Parameters:
key- aStringobject- Returns:
- a
ReentrantLockobject
-
getClusterMutex
getClusterMutex.
Returns a cluster-aware lock using JobLockService for global job synchronization. Use this for global job locks (projectformulationjob, entityactivityjob, etc.) to ensure only one node in the cluster executes the job at a time.- Parameters:
key- aStringobject (used for the ReentrantLock map)lockName- aStringobject (used as QName local name for JobLockService)- Returns:
- a
ReentrantLockobject
-
removeMutex
removeMutex.
-