Interface IObjectLockManager
- All Known Implementing Classes:
ObjectLockManager
public interface IObjectLockManager
Defines the object lock manager
-
Method Summary
Modifier and TypeMethodDescriptionGet the statistics of locks that could not be obtained because they are already locked.Get the object lock statistic (the number of lock elements)longGet the count of how many times the max lock size was reachedGet the statistics of locks that could not be obtained because of the unlock timeout.<L extends Serializable>
List<L> Locks a list of objects inside the same JVM.voidRelease all object locks and resourcessetObjectLockSize(Integer size) Sets the size of the object locksetUnlockTimeout(Long timeout) Sets the unlock timeout which defines how long an element can't be locked again after an unlock<L extends Serializable>
List<L> Unlock a list of objects inside the same JVM.
-
Method Details
-
setObjectLockSize
Sets the size of the object lock- Parameters:
size- the object lock size (positive number) or null- Returns:
- the instance
-
setUnlockTimeout
Sets the unlock timeout which defines how long an element can't be locked again after an unlock- Parameters:
timeout- the unlock timeout (positive number) or null- Returns:
- the instance
-
lock
Locks a list of objects inside the same JVM.- Type Parameters:
L- the object lock type- Parameters:
theObjectLockList- the list of objects to lock- Returns:
- Returns only the successfully locked objects. It returns in all cases a list but it doesn't throws any exceptions!
-
unlock
Unlock a list of objects inside the same JVM.- Type Parameters:
L- the object lock type- Parameters:
theObjectLockList- the list of objects to unlock- Returns:
- the list of objects to unlock
-
releaseResource
void releaseResource()Release all object locks and resources -
getLockStatistic
StatisticCounter getLockStatistic()Get the object lock statistic (the number of lock elements)- Returns:
- the object lock statistic
-
getUnlockStatistic
StatisticCounter getUnlockStatistic()Get the statistics of locks that could not be obtained because of the unlock timeout.- Returns:
- the object unlock statistic
-
getIgnoreLockStatistic
StatisticCounter getIgnoreLockStatistic()Get the statistics of locks that could not be obtained because they are already locked.- Returns:
- the ignore object lock statistic
-
getNumberOfLockSizeReached
long getNumberOfLockSizeReached()Get the count of how many times the max lock size was reached- Returns:
- the count of how many times the max lock size was reached
-