public class QuartzSessionValidationScheduler extends Object implements org.apache.shiro.session.mgt.SessionValidationScheduler
SessionValidationScheduler
that uses Quartz to schedule a
job to call ValidatingSessionManager.validateSessions()
on
a regular basis.Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_SESSION_VALIDATION_INTERVAL
The default interval at which sessions will be validated (1 hour);
This can be overridden by calling
setSessionValidationInterval(long) |
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
void |
disableSessionValidation() |
void |
enableSessionValidation()
Starts session validation by creating a Quartz simple trigger, linking it to
the
QuartzSessionValidationJob , and scheduling it with the Quartz scheduler. |
protected Scheduler |
getScheduler() |
boolean |
isEnabled() |
void |
setScheduler(Scheduler scheduler) |
void |
setSessionManager(org.apache.shiro.session.mgt.ValidatingSessionManager sessionManager) |
void |
setSessionValidationInterval(long sessionValidationInterval)
Specifies how frequently (in milliseconds) this Scheduler will call the
ValidatingSessionManager#validateSessions() method. |
public static final long DEFAULT_SESSION_VALIDATION_INTERVAL
setSessionValidationInterval(long)
public QuartzSessionValidationScheduler()
public QuartzSessionValidationScheduler(org.apache.shiro.session.mgt.ValidatingSessionManager sessionManager)
sessionManager
- the SessionManager that should be used to validate sessions.protected Scheduler getScheduler() throws SchedulerException
SchedulerException
public void setScheduler(Scheduler scheduler)
public void setSessionManager(org.apache.shiro.session.mgt.ValidatingSessionManager sessionManager)
public boolean isEnabled()
isEnabled
in interface org.apache.shiro.session.mgt.SessionValidationScheduler
public void setSessionValidationInterval(long sessionValidationInterval)
ValidatingSessionManager#validateSessions()
method.
Unless this method is called, the default value is DEFAULT_SESSION_VALIDATION_INTERVAL
.
sessionValidationInterval
- public void enableSessionValidation()
QuartzSessionValidationJob
, and scheduling it with the Quartz scheduler.enableSessionValidation
in interface org.apache.shiro.session.mgt.SessionValidationScheduler
public void disableSessionValidation()
disableSessionValidation
in interface org.apache.shiro.session.mgt.SessionValidationScheduler
Copyright © 2004–2020 The Apache Software Foundation. All rights reserved.