/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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.apache.catalina.session;
/** * Abstract implementation of the {@link Store} interface to support most of the functionality required by a * {@link Store}. * * @author Bip Thelin
*/ publicabstractclass StoreBase extends LifecycleBase implements Store {
/** * @return the name for this Store, used for logging.
*/ public String getStoreName() { return storeName;
}
/** * Set the Manager with which this Store is associated. * * @param manager The newly associated Manager
*/
@Override publicvoid setManager(Manager manager) {
Manager oldManager = this.manager; this.manager = manager;
support.firePropertyChange("manager", oldManager, this.manager);
}
/** * @return the Manager with which the Store is associated.
*/
@Override public Manager getManager() { returnthis.manager;
}
// --------------------------------------------------------- Public Methods
/** * Add a property change listener to this component. * * @param listener a value of type {@link PropertyChangeListener}
*/
@Override publicvoid addPropertyChangeListener(PropertyChangeListener listener) {
support.addPropertyChangeListener(listener);
}
/** * Remove a property change listener from this component. * * @param listener The listener to remove
*/
@Override publicvoid removePropertyChangeListener(PropertyChangeListener listener) {
support.removePropertyChangeListener(listener);
}
/** * Get only those keys of sessions, that are saved in the Store and are to be expired. * * @return list of session keys, that are to be expired * * @throws IOException if an input-/output error occurred
*/ public String[] expiredKeys() throws IOException { return keys();
}
/** * Called by our background reaper thread to check if Sessions saved in our store are subject of being expired. If * so expire the Session and remove it from the Store.
*/ publicvoid processExpires() {
String[] keys = null;
/** * Create the object input stream to use to read a session from the store. Sub-classes <b>must</b> have set the * thread context class loader before calling this method. * * @param is The input stream provided by the sub-class that will provide the data for a session * * @return An appropriately configured ObjectInputStream from which the session can be read. * * @throws IOException if a problem occurs creating the ObjectInputStream
*/ protected ObjectInputStream getObjectInputStream(InputStream is) throws IOException {
BufferedInputStream bis = new BufferedInputStream(is);
/** * Start this component and implement the requirements of {@link LifecycleBase#startInternal()}. * * @exception LifecycleException if this component detects a fatal error that prevents this component from being * used
*/
@Override protectedsynchronizedvoid startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
}
/** * Stop this component and implement the requirements of {@link LifecycleBase#stopInternal()}. * * @exception LifecycleException if this component detects a fatal error that prevents this component from being * used
*/
@Override protectedsynchronizedvoid stopInternal() throws LifecycleException {
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.