Package io.jmix.pessimisticlock.impl
Class LockManagerImpl
java.lang.Object
io.jmix.pessimisticlock.impl.LockManagerImpl
- All Implemented Interfaces:
LockManager
@Component("pslock_LockManagerImpl")
public class LockManagerImpl
extends Object
implements LockManager
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.springframework.cache.CacheManagerprotected final CacheOperationsprotected Map<String,LockDescriptor> protected final CurrentAuthenticationprotected final ExtendedEntitiesprotected List<LockDescriptorProvider>protected org.springframework.cache.Cacheprotected static final org.slf4j.Loggerprotected final Metadataprotected final MetadataToolsprotected final TimeSourceFields inherited from interface io.jmix.pessimisticlock.LockManager
LOCKS_CACHE_NAME -
Constructor Summary
ConstructorsConstructorDescriptionLockManagerImpl(ExtendedEntities extendedEntities, Metadata metadata, MetadataTools metadataTools, TimeSource timeSource, CurrentAuthentication currentAuthentication, org.springframework.cache.CacheManager cacheManager, CacheOperations cacheOperations, List<LockDescriptorProvider> lockDescriptorProviders) -
Method Summary
Modifier and TypeMethodDescriptionvoidProcess locks expiring.protected Map<String,LockDescriptor> Collection of current locksgetLockInfo(String name, String id) Get locking status for particular objectprotected voidinit()protected booleanisCurrentUserLock(LockInfo lockInfo) Try to lock an entity.Try to lock an arbitrary object.voidvoidUnlock an entity.voidUnlock an arbitrary object.voidUnlock an arbitrary object.
-
Field Details
-
log
protected static final org.slf4j.Logger log -
extendedEntities
-
metadata
-
metadataTools
-
timeSource
-
currentAuthentication
-
cacheManager
protected final org.springframework.cache.CacheManager cacheManager -
cacheOperations
-
lockDescriptorProviders
-
config
-
locks
protected org.springframework.cache.Cache locks
-
-
Constructor Details
-
LockManagerImpl
public LockManagerImpl(ExtendedEntities extendedEntities, Metadata metadata, MetadataTools metadataTools, TimeSource timeSource, CurrentAuthentication currentAuthentication, org.springframework.cache.CacheManager cacheManager, CacheOperations cacheOperations, List<LockDescriptorProvider> lockDescriptorProviders)
-
-
Method Details
-
init
@PostConstruct protected void init() -
getConfig
-
lock
Description copied from interface:LockManagerTry to lock an arbitrary object.- Specified by:
lockin interfaceLockManager- Parameters:
name- locking object nameid- locking object ID- Returns:
- - null in case of successful lock,
-LockNotSupportedinstance in case of locking is not configured for this object,
-LockInfoinstance in case of this object is already locked by someone
-
lock
Description copied from interface:LockManagerTry to lock an entity.- Specified by:
lockin interfaceLockManager- Parameters:
entity- entity instance- Returns:
- - null in case of successful lock,
-LockNotSupportedinstance in case of locking is not configured for this entity,
-LockInfoinstance in case of this entity is already locked by someone
-
unlock
Description copied from interface:LockManagerUnlock an arbitrary object.- Specified by:
unlockin interfaceLockManager- Parameters:
name- locking object nameid- locking object ID
-
unlock
Description copied from interface:LockManagerUnlock an arbitrary object.- Specified by:
unlockin interfaceLockManager- Parameters:
name- locking object nameid- locking object IDforce- force unlock even if the lock is not owned by the current owner
-
unlock
Description copied from interface:LockManagerUnlock an entity.- Specified by:
unlockin interfaceLockManager- Parameters:
entity- entity instance
-
getLockInfo
Description copied from interface:LockManagerGet locking status for particular object- Specified by:
getLockInfoin interfaceLockManager- Parameters:
name- locking object nameid- locking object ID- Returns:
- - null in case of no lock,
-LockNotSupportedinstance in case of locking is not configured for this object,
-LockInfoinstance in case of this object is locked by someone
-
getCurrentLocks
Description copied from interface:LockManagerCollection of current locks- Specified by:
getCurrentLocksin interfaceLockManager
-
expireLocks
public void expireLocks()Description copied from interface:LockManagerProcess locks expiring. All expired locks will be removed.- Specified by:
expireLocksin interfaceLockManager
-
reloadConfiguration
public void reloadConfiguration()- Specified by:
reloadConfigurationin interfaceLockManager
-
isCurrentUserLock
-