Package org.apache.catalina.session
Class SessionLock
- java.lang.Object
-
- org.apache.catalina.session.SessionLock
-
public class SessionLock extends Object
-
-
Constructor Summary
Constructors Constructor Description SessionLock()Creates a new instance of SessionLock
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddecrementForegroundRefCount()decrement the foregroundRefCountintgetForegroundRefCount()get the foregroundRefCountStringgetLockType()get the lock typebooleanhasNonHttpLockOccurred()voidincrementForegroundRefCount()increment the foregroundRefCountbooleanisBackgroundLocked()return whether lock is background lockedbooleanisForegroundLocked()return whether lock is foreground lockedbooleanisLocked()return whether lock is locked (either foreground or background)booleanlockBackground()if possible, the lock will be background locked if the lock is already foreground locked the method will return false and the lock remains foreground locked (i.e.booleanlockForeground()if possible, the lock will be foreground locked if it was already foreground locked; it will remain so and the foregroundRefCount will be incremented if the lock is already background locked the method will return false and the lock remains background locked (i.e.booleanlockForeground(boolean isHttp)voidsetForegroundRefCount(int foregroundRefCount)set the foregroundRefCountvoidsetLockType(String lockType)set the lock type - lockType must be BACKGROUND_LOCK or FOREGROUND_LOCKStringtoString()returns String representation of the state of the lockvoidunlock()unlock the lock if background locked the lock will become fully unlocked if foreground locked the lock will become fully unlocked if foregroundRefCount was 1; otherwise it will decrement the foregroundRefCount and the lock will remain foreground lockedvoidunlockBackground()unlock the lock for the background locked case the lock will be unlockedvoidunlockForeground()unlock the lock for the foreground locked case the lock will be unlocked if foregroundRefCount was 1; otherwise it will decrement the foregroundRefCount and the lock will remain foreground lockedvoidunlockForegroundCompletely()unlock the lock this is a force unlock; foregroundRefCount is ignored
-
-
-
Method Detail
-
getLockType
public String getLockType()
get the lock type
-
setLockType
public void setLockType(String lockType)
set the lock type - lockType must be BACKGROUND_LOCK or FOREGROUND_LOCK- Parameters:
lockType- the type of the lock
-
getForegroundRefCount
public int getForegroundRefCount()
get the foregroundRefCount
-
setForegroundRefCount
public void setForegroundRefCount(int foregroundRefCount)
set the foregroundRefCount- Parameters:
foregroundRefCount-
-
incrementForegroundRefCount
public void incrementForegroundRefCount()
increment the foregroundRefCount
-
decrementForegroundRefCount
public void decrementForegroundRefCount()
decrement the foregroundRefCount
-
isBackgroundLocked
public boolean isBackgroundLocked()
return whether lock is background locked
-
isForegroundLocked
public boolean isForegroundLocked()
return whether lock is foreground locked
-
isLocked
public boolean isLocked()
return whether lock is locked (either foreground or background)
-
hasNonHttpLockOccurred
public boolean hasNonHttpLockOccurred()
- Returns:
- true if lock has been locked by non-http request, false otherwise
-
unlock
public void unlock()
unlock the lock if background locked the lock will become fully unlocked if foreground locked the lock will become fully unlocked if foregroundRefCount was 1; otherwise it will decrement the foregroundRefCount and the lock will remain foreground locked
-
unlockForeground
public void unlockForeground()
unlock the lock for the foreground locked case the lock will be unlocked if foregroundRefCount was 1; otherwise it will decrement the foregroundRefCount and the lock will remain foreground locked
-
unlockForegroundCompletely
public void unlockForegroundCompletely()
unlock the lock this is a force unlock; foregroundRefCount is ignored
-
unlockBackground
public void unlockBackground()
unlock the lock for the background locked case the lock will be unlocked
-
lockForeground
public boolean lockForeground()
if possible, the lock will be foreground locked if it was already foreground locked; it will remain so and the foregroundRefCount will be incremented if the lock is already background locked the method will return false and the lock remains background locked (i.e. lock failed) otherwise it will return true (lock succeeded)
-
lockForeground
public boolean lockForeground(boolean isHttp)
-
lockBackground
public boolean lockBackground()
if possible, the lock will be background locked if the lock is already foreground locked the method will return false and the lock remains foreground locked (i.e. lock failed) otherwise it will return true (lock succeeded)
-
-