Package org.apache.shiro.session.mgt
Class ExecutorServiceSessionValidationScheduler
- java.lang.Object
-
- org.apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler
-
- All Implemented Interfaces:
Runnable,SessionValidationScheduler
public class ExecutorServiceSessionValidationScheduler extends Object implements SessionValidationScheduler, Runnable
SessionValidationScheduler implementation that uses aScheduledExecutorServiceto callValidatingSessionManager.validateSessions()everyintervalmilliseconds.- Since:
- 0.9
-
-
Constructor Summary
Constructors Constructor Description ExecutorServiceSessionValidationScheduler()ExecutorServiceSessionValidationScheduler(ValidatingSessionManager sessionManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisableSessionValidation()Disables the session validation job.voidenableSessionValidation()Creates a single threadScheduledExecutorServiceto validate sessions at fixed intervals and enables this scheduler.longgetInterval()ValidatingSessionManagergetSessionManager()StringgetThreadNamePrefix()booleanisEnabled()Returnstrueif this Scheduler is enabled and ready to begin validation at the appropriate time,falseotherwise.voidrun()voidsetInterval(long interval)voidsetSessionManager(ValidatingSessionManager sessionManager)voidsetThreadNamePrefix(String threadNamePrefix)
-
-
-
Constructor Detail
-
ExecutorServiceSessionValidationScheduler
public ExecutorServiceSessionValidationScheduler()
-
ExecutorServiceSessionValidationScheduler
public ExecutorServiceSessionValidationScheduler(ValidatingSessionManager sessionManager)
-
-
Method Detail
-
getSessionManager
public ValidatingSessionManager getSessionManager()
-
setSessionManager
public void setSessionManager(ValidatingSessionManager sessionManager)
-
getInterval
public long getInterval()
-
setInterval
public void setInterval(long interval)
-
isEnabled
public boolean isEnabled()
Description copied from interface:SessionValidationSchedulerReturnstrueif this Scheduler is enabled and ready to begin validation at the appropriate time,falseotherwise. It does not indicate if the validation is actually executing at that instant - only that it is prepared to do so at the appropriate time.- Specified by:
isEnabledin interfaceSessionValidationScheduler- Returns:
trueif this Scheduler is enabled and ready to begin validation at the appropriate time,falseotherwise.
-
setThreadNamePrefix
public void setThreadNamePrefix(String threadNamePrefix)
-
getThreadNamePrefix
public String getThreadNamePrefix()
-
enableSessionValidation
public void enableSessionValidation()
Creates a single threadScheduledExecutorServiceto validate sessions at fixed intervals and enables this scheduler. The executor is created as a daemon thread to allow JVM to shut down- Specified by:
enableSessionValidationin interfaceSessionValidationScheduler
-
disableSessionValidation
public void disableSessionValidation()
Description copied from interface:SessionValidationSchedulerDisables the session validation job.- Specified by:
disableSessionValidationin interfaceSessionValidationScheduler
-
-