Cleanable

What is it?

Cleanable is an interface used to denote that the class has a method to be called for it to be cleaned. Within the CAS ecosystem, classes that implement the Cleanable interface will automatically be registered with a thread that will execute the prune method on regular intervals. For completeness, the interface is shown below.

Cleanable.java
/**
 * Copyright (C) 2009 Jasig, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jasig.cas.server.util;

/**
 * @author Scott Battaglia
 * @version $Revision$ $Date$
 * @since 4.0.0
 *
 * Note: This class is inspired by some work Brad Cupit did for the Jasig CAS Client for Java.
 */
public interface Cleanable {

    /**
     * Notifies the class that it should attempt to clean up its internal data-store.
     * <p>
     * Note that while the class can delay or bundle multiple requests together, it should never
     * completely ignore the request to prune its own internal data-store.
     * <p>
     * The one exception to the above rule is a class who's internal data-store has its own
     * mechanism for cleaning itself (i.e. memcached's timeout mechanism).  In this particular instance, prune() can
     * be considered a no-op.
     *
     */
    void prune();
}