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
-
Field Summary
Modifier and TypeFieldDescriptionprotected final org.springframework.cache.CacheManager
protected final CacheOperations
protected Map<String,
LockDescriptor> protected final CurrentAuthentication
protected final ExtendedEntities
protected List<LockDescriptorProvider>
protected org.springframework.cache.Cache
protected static final org.slf4j.Logger
protected final Metadata
protected final MetadataTools
protected final TimeSource
Fields inherited from interface io.jmix.pessimisticlock.LockManager
LOCKS_CACHE_NAME
-
Constructor Summary
ConstructorDescriptionLockManagerImpl
(ExtendedEntities extendedEntities, Metadata metadata, MetadataTools metadataTools, TimeSource timeSource, CurrentAuthentication currentAuthentication, org.springframework.cache.CacheManager cacheManager, CacheOperations cacheOperations, List<LockDescriptorProvider> lockDescriptorProviders) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Process locks expiring.protected Map<String,
LockDescriptor> Collection of current locksgetLockInfo
(String name, String id) Get locking status for particular objectprotected void
init()
Try to lock an entity.Try to lock an arbitrary object.void
void
Unlock an entity.void
Unlock 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:LockManager
Try to lock an arbitrary object.- Specified by:
lock
in interfaceLockManager
- Parameters:
name
- locking object nameid
- locking object ID- Returns:
- - null in case of successful lock,
-LockNotSupported
instance in case of locking is not configured for this object,
-LockInfo
instance in case of this object is already locked by someone
-
lock
Description copied from interface:LockManager
Try to lock an entity.- Specified by:
lock
in interfaceLockManager
- Parameters:
entity
- entity instance- Returns:
- - null in case of successful lock,
-LockNotSupported
instance in case of locking is not configured for this entity,
-LockInfo
instance in case of this entity is already locked by someone
-
unlock
Description copied from interface:LockManager
Unlock an arbitrary object.- Specified by:
unlock
in interfaceLockManager
- Parameters:
name
- locking object nameid
- locking object ID
-
unlock
Description copied from interface:LockManager
Unlock an entity.- Specified by:
unlock
in interfaceLockManager
- Parameters:
entity
- entity instance
-
getLockInfo
Description copied from interface:LockManager
Get locking status for particular object- Specified by:
getLockInfo
in interfaceLockManager
- Parameters:
name
- locking object nameid
- locking object ID- Returns:
- - null in case of no lock,
-LockNotSupported
instance in case of locking is not configured for this object,
-LockInfo
instance in case of this object is locked by someone
-
getCurrentLocks
Description copied from interface:LockManager
Collection of current locks- Specified by:
getCurrentLocks
in interfaceLockManager
-
expireLocks
public void expireLocks()Description copied from interface:LockManager
Process locks expiring. All expired locks will be removed.- Specified by:
expireLocks
in interfaceLockManager
-
reloadConfiguration
public void reloadConfiguration()- Specified by:
reloadConfiguration
in interfaceLockManager
-