Class 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 the SessionValidationScheduler that uses Quartz to schedule a job to call ValidatingSessionManager.validateSessions() on a regular basis.
    Since:
    0.1
    • 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:
        isEnabled in interface org.apache.shiro.session.mgt.SessionValidationScheduler
      • setSessionValidationInterval

        public void setSessionValidationInterval​(long sessionValidationInterval)
        Specifies how frequently (in milliseconds) this Scheduler will call the ValidatingSessionManager#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 the QuartzSessionValidationJob, and scheduling it with the Quartz scheduler.
        Specified by:
        enableSessionValidation in interface org.apache.shiro.session.mgt.SessionValidationScheduler
      • disableSessionValidation

        public void disableSessionValidation()
        Specified by:
        disableSessionValidation in interface org.apache.shiro.session.mgt.SessionValidationScheduler