Class TimeSlotLockService
java.lang.Object
overit.geocallapp.wfm.scheduling.bl.lock.service.TimeSlotLockService
- All Implemented Interfaces:
LockService
TimeSlotLockService is an implementation of the LockService interface
that manages locks using a database-based approach.
This service ensures that resources, activities, and operation centers are locked
within specified time slots to prevent concurrent access during scheduling operations.
The locks are stored and managed in a database, providing a persistent and reliable
mechanism for coordinating access to shared resources. The lock is associated with
a unique identifier (UUID) for each transaction, allowing for efficient management
and release of locks at the end of the transaction.
- Since:
- 18.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacquireLock(String uuid, String key, int timeout) This method acquires a new lockvoidextendLock(String uuid, int timeout) This method extends a lock by uuidbooleanThis method checks if the entity is locked.voidvoidreleaseLock(String uuid) This method releases a lock by uuid
-
Constructor Details
-
TimeSlotLockService
public TimeSlotLockService()
-
-
Method Details
-
acquireLock
public boolean acquireLock(String uuid, String key, int timeout) throws DAValidateException, DAException This method acquires a new lock- Specified by:
acquireLockin interfaceLockService- Parameters:
uuid- the uuidkey- the lock keytimeout- the timeout after which the lock expires- Throws:
DAExceptionDAValidateException
-
releaseLock
This method releases a lock by uuid- Specified by:
releaseLockin interfaceLockService- Parameters:
uuid- the uuid- Throws:
DAExceptionDAValidateException
-
releaseAllLocks
- Specified by:
releaseAllLocksin interfaceLockService- Throws:
DAExceptionDAValidateException
-
extendLock
This method extends a lock by uuid- Specified by:
extendLockin interfaceLockService- Parameters:
uuid- the uuidtimeout- the timeout- Throws:
DAExceptionDAValidateException
-
isLocked
public boolean isLocked(String baseLockKey, boolean checkTotalCOScope) throws DAValidateException, DAException This method checks if the entity is locked. If checkTotalScope is true, it verifies whether the entire operation center is locked. Otherwise, it checks for a partial or total lock on that operation center.- Specified by:
isLockedin interfaceLockService- Parameters:
baseLockKey- the base lock key composed by operation center and eventually scheduling modelcheckTotalCOScope- if true verifies whether the entire operation center is locked- Throws:
DAExceptionDAValidateException
-