Class QuartzSessionValidationScheduler
- java.lang.Object
-
- org.apache.shiro.session.mgt.quartz.QuartzSessionValidationScheduler
-
- All Implemented Interfaces:
org.apache.shiro.session.mgt.SessionValidationScheduler
public class QuartzSessionValidationScheduler extends Object implements org.apache.shiro.session.mgt.SessionValidationScheduler
An implementation of theSessionValidationSchedulerthat uses Quartz to schedule a job to callValidatingSessionManager.validateSessions()on a regular basis.- Since:
- 0.1
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_SESSION_VALIDATION_INTERVALThe default interval at which sessions will be validated (1 hour); This can be overridden by callingsetSessionValidationInterval(long)
-
Constructor Summary
Constructors Constructor Description QuartzSessionValidationScheduler()Default constructor.QuartzSessionValidationScheduler(org.apache.shiro.session.mgt.ValidatingSessionManager sessionManager)Constructor that specifies the session manager that should be used for validating sessions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisableSessionValidation()voidenableSessionValidation()Starts session validation by creating a Quartz simple trigger, linking it to theQuartzSessionValidationJob, and scheduling it with the Quartz scheduler.protected org.quartz.SchedulergetScheduler()booleanisEnabled()voidsetScheduler(org.quartz.Scheduler scheduler)voidsetSessionManager(org.apache.shiro.session.mgt.ValidatingSessionManager sessionManager)voidsetSessionValidationInterval(long sessionValidationInterval)Specifies how frequently (in milliseconds) this Scheduler will call theValidatingSessionManager#validateSessions()method.
-
-
-
Field Detail
-
DEFAULT_SESSION_VALIDATION_INTERVAL
public static final long DEFAULT_SESSION_VALIDATION_INTERVAL
The default interval at which sessions will be validated (1 hour); This can be overridden by callingsetSessionValidationInterval(long)- See Also:
- Constant Field Values
-
-
Constructor Detail
-
QuartzSessionValidationScheduler
public QuartzSessionValidationScheduler()
Default constructor.
-
QuartzSessionValidationScheduler
public QuartzSessionValidationScheduler(org.apache.shiro.session.mgt.ValidatingSessionManager sessionManager)
Constructor that specifies the session manager that should be used for validating sessions.- Parameters:
sessionManager- the SessionManager that should be used to validate sessions.
-
-
Method Detail
-
getScheduler
protected org.quartz.Scheduler getScheduler() throws org.quartz.SchedulerException- Throws:
org.quartz.SchedulerException
-
setScheduler
public void setScheduler(org.quartz.Scheduler scheduler)
-
setSessionManager
public void setSessionManager(org.apache.shiro.session.mgt.ValidatingSessionManager sessionManager)
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfaceorg.apache.shiro.session.mgt.SessionValidationScheduler
-
setSessionValidationInterval
public void setSessionValidationInterval(long sessionValidationInterval)
Specifies how frequently (in milliseconds) this Scheduler will call theValidatingSessionManager#validateSessions()method.Unless this method is called, the default value is
DEFAULT_SESSION_VALIDATION_INTERVAL.- Parameters:
sessionValidationInterval-
-
enableSessionValidation
public void enableSessionValidation()
Starts session validation by creating a Quartz simple trigger, linking it to theQuartzSessionValidationJob, and scheduling it with the Quartz scheduler.- Specified by:
enableSessionValidationin interfaceorg.apache.shiro.session.mgt.SessionValidationScheduler
-
disableSessionValidation
public void disableSessionValidation()
- Specified by:
disableSessionValidationin interfaceorg.apache.shiro.session.mgt.SessionValidationScheduler
-
-