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 void
decrementForegroundRefCount()
decrement the foregroundRefCountint
getForegroundRefCount()
get the foregroundRefCountString
getLockType()
get the lock typeboolean
hasNonHttpLockOccurred()
void
incrementForegroundRefCount()
increment the foregroundRefCountboolean
isBackgroundLocked()
return whether lock is background lockedboolean
isForegroundLocked()
return whether lock is foreground lockedboolean
isLocked()
return whether lock is locked (either foreground or background)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.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.boolean
lockForeground(boolean isHttp)
void
setForegroundRefCount(int foregroundRefCount)
set the foregroundRefCountvoid
setLockType(String lockType)
set the lock type - lockType must be BACKGROUND_LOCK or FOREGROUND_LOCKString
toString()
returns String representation of the state of the lockvoid
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 lockedvoid
unlockBackground()
unlock the lock for the background locked case the lock will be unlockedvoid
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 lockedvoid
unlockForegroundCompletely()
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)
-
-