Interface IObjectLockManager
-
- All Known Implementing Classes:
ObjectLockManager
public interface IObjectLockManagerDefines the object lock manager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StatisticCountergetIgnoreLockStatistic()Get the statistics of locks that could not be obtained because they are already locked.StatisticCountergetLockStatistic()Get the object lock statistic (the number of lock elements)longgetNumberOfLockSizeReached()Get the count of how many times the max lock size was reachedStatisticCountergetUnlockStatistic()Get the statistics of locks that could not be obtained because of the unlock timeout.<L extends java.io.Serializable>
java.util.List<L>lock(java.util.List<L> theObjectLockList)Locks a list of objects inside the same JVM.voidreleaseResource()Release all object locks and resourcesIObjectLockManagersetObjectLockSize(java.lang.Integer size)Sets the size of the object lockIObjectLockManagersetUnlockTimeout(java.lang.Long timeout)Sets the unlock timeout which defines how long an element can't be locked again after an unlock<L extends java.io.Serializable>
java.util.List<L>unlock(java.util.List<L> theObjectLockList)Unlock a list of objects inside the same JVM.
-
-
-
Method Detail
-
setObjectLockSize
IObjectLockManager setObjectLockSize(java.lang.Integer size)
Sets the size of the object lock- Parameters:
size- the object lock size (positive number) or null- Returns:
- the instance
-
setUnlockTimeout
IObjectLockManager setUnlockTimeout(java.lang.Long timeout)
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
<L extends java.io.Serializable> java.util.List<L> lock(java.util.List<L> theObjectLockList)
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
<L extends java.io.Serializable> java.util.List<L> unlock(java.util.List<L> theObjectLockList)
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
-
-