001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.shiro.session.mgt;
020
021/**
022 * Interface that should be implemented by classes that can control validating sessions on a regular
023 * basis.  This interface is used as a delegate for session validation
024 * by the {@link org.apache.shiro.session.mgt.DefaultSessionManager}
025 *
026 * @see org.apache.shiro.session.mgt.DefaultSessionManager#setSessionValidationScheduler(SessionValidationScheduler)
027 * @since 0.1
028 */
029public interface SessionValidationScheduler {
030
031    /**
032     * Returns <code>true</code> if this Scheduler is enabled and ready to begin validation at the appropriate time,
033     * <code>false</code> otherwise.
034     * <p/>
035     * It does <em>not</em> indicate if the validation is actually executing at that instant - only that it is prepared
036     * to do so at the appropriate time.
037     *
038     * @return <code>true</code> if this Scheduler is enabled and ready to begin validation at the appropriate time,
039     * <code>false</code> otherwise.
040     */
041    boolean isEnabled();
042
043    /**
044     * Enables the session validation job.
045     */
046    void enableSessionValidation();
047
048    /**
049     * Disables the session validation job.
050     */
051    void disableSessionValidation();
052
053}