public abstract class LockManager extends Object
- simple get[Write|Read]Lock - single request
- getSleep[Write|Read]Lock - repetative requests in case of failure until succes (or timeout). Following attempts are processed after a period of sleeping.
- getSpin[Write|Read]Lock - repetative requests in case of failure until succes (or timeout). Following attempts are proccesed imediatly after failure.
Constructor and Description |
---|
LockManager()
Constructor
|
Modifier and Type | Method and Description |
---|---|
File |
createUniqueFile(String location,
String prefix)
Creates a unique file with the input prefix in the input location.
|
void |
ensureModifierActiveState(String globalTankerLocation,
String localTankerLocation)
Ensures that a caller has an active modifier state.
|
LockResult |
getReadLock(String location,
long indexConstPeriodOfTime,
long threadGroupId,
int timeOut)
Gets a READ lock in the location using only single request.
|
boolean |
getSleepReadLock(String location,
long indexConstPeriodOfTime,
long threadGroupId,
int timeOut)
Gets a READ lock in the location, using sleeping - repetative requests
until succes with short sleeping in between.
|
boolean |
getSleepRecoveryLock(String location,
int timeOut)
Gets a RECOVERY lock in the location, using sleeping - repetative requests
until succes with short sleeping in between.
|
boolean |
getSleepWriteLock(String location,
int timeOut)
Gets a WRITE lock in the location, using sleeping - repetative requests
until succes with short sleeping in between.
|
boolean |
getSpinReadLock(String location,
long indexConstPeriodOfTime,
long threadGroupId,
int timeOut)
Gets a READ lock in the location, using spinning - repetative requests
until succes with no delay in between.
|
boolean |
getSpinRecoveryLock(String location,
int timeOut)
Gets a RECOVERY lock in the location, using spinning - repetative requests
until succes with no delay in between.
|
boolean |
getSpinWriteLock(String location,
int timeOut)
Gets a WRITE lock in the location, using spinning - repetative requests
until succes with no delay in between.
|
LockResult |
getWriteLock(String location,
int timeOut)
Gets a WRITE lock in the location using only single request.
|
boolean |
isIndexConstant(String location,
long threadGroupId)
Checks whether index in the location is constant for the caller.
|
boolean |
releaseLock(String location)
Releases lock in the location.
|
void |
removeActiveModifierState(String globalTankerLocation,
String localTankerLocation)
Removes active modifier state from the location
|
void |
removeIndexConstState(String location,
long threadGroupId)
Discards index constancy in the location.
|
public boolean getSpinReadLock(String location, long indexConstPeriodOfTime, long threadGroupId, int timeOut)
location
- Location to lockindexConstPeriodOfTime
- Period of time when index will remain constant for the callerthreadGroupId
- Id of a group of thread that share single instance of a tankertimeOut
- Period of time in which this request must be processedtrue
if lock granted, false
otherwisepublic boolean getSpinWriteLock(String location, int timeOut)
location
- Location to locktimeOut
- Period of time in which this request must be processedtrue
if lock granted, false
otherwisepublic boolean getSleepReadLock(String location, long indexConstPeriodOfTime, long threadGroupId, int timeOut)
location
- Location to lockindexConstPeriodOfTime
- Period of time when index will remain constant for the callerthreadGroupId
- Id of a group of thread that share single instance of a tankertimeOut
- Period of time in which this request must be processedtrue
if lock granted, false
otherwisepublic boolean getSleepWriteLock(String location, int timeOut)
location
- Location to locktimeOut
- Period of time in which this request must be processedtrue
if lock granted, false
otherwisepublic boolean getSpinRecoveryLock(String location, int timeOut)
location
- Location to locktimeOut
- Period of time in which this request must be processedtrue
if lock granted, false
otherwisepublic boolean getSleepRecoveryLock(String location, int timeOut)
location
- Location to locktimeOut
- Period of time in which this request must be processedtrue
if lock granted, false
otherwisepublic LockResult getReadLock(String location, long indexConstPeriodOfTime, long threadGroupId, int timeOut)
location
- Location to lockindexConstPeriodOfTime
- Period of time when index will remain constant for the callerthreadGroupId
- Id of a group of thread that share single instance of a tankertimeOut
- Period of time in which this request must be processedtrue
if lock granted, false
otherwisepublic LockResult getWriteLock(String location, int timeOut)
location
- Location to locktimeOut
- Period of time in which this request must be processedtrue
if lock granted, false
otherwisepublic boolean releaseLock(String location)
location
- Location where the lock should be releasedtrue
if lock released, false
otherwisepublic boolean isIndexConstant(String location, long threadGroupId)
true
if constancy is valid, false
otherwiselocation
- Location where to check a constancy statethreadGroupId
- Identifier of a group of threads that share one instance of the tanker.true
if constancy is valid, false
otherwisepublic void removeIndexConstState(String location, long threadGroupId)
location
- Location where to cancel a constancy for the callerthreadGroupId
- Identifier of a group of threads that share one instance of the tanker.public void ensureModifierActiveState(String globalTankerLocation, String localTankerLocation)
globalTankerLocation
- Location where a active modifier state should be createdlocalTankerLocation
- Location of tanker where modifications are stored before
commitpublic void removeActiveModifierState(String globalTankerLocation, String localTankerLocation)
globalTankerLocation
- Location where an active modifier state should be canceledlocalTankerLocation
- TODOCopyright © 2016 Egothor. All Rights Reserved.