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     */
019    package 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 by the {@link org.apache.shiro.session.mgt.DefaultSessionManager}
024     *
025     * @see org.apache.shiro.session.mgt.DefaultSessionManager#setSessionValidationScheduler(SessionValidationScheduler)
026     * @since 0.1
027     */
028    public interface SessionValidationScheduler {
029    
030        /**
031         * Returns <code>true</code> if this Scheduler is enabled and ready to begin validation at the appropriate time,
032         * <code>false</code> otherwise.
033         * <p/>
034         * It does <em>not</em> indicate if the validation is actually executing at that instant - only that it is prepared
035         * to do so at the appropriate time.
036         *
037         * @return <code>true</code> if this Scheduler is enabled and ready to begin validation at the appropriate time,
038         * <code>false</code> otherwise.
039         */
040        boolean isEnabled();
041    
042        /**
043         * Enables the session validation job.
044         */
045        void enableSessionValidation();
046    
047        /**
048         * Disables the session validation job.
049         */
050        void disableSessionValidation();
051    
052    }