Package org.apache.catalina.session
Class StoreBase
- java.lang.Object
-
- org.apache.catalina.util.LifecycleBase
-
- org.apache.catalina.session.StoreBase
-
- Direct Known Subclasses:
DataSourceStore,FileStore
public abstract class StoreBase extends LifecycleBase implements Store
Abstract implementation of theStoreinterface to support most of the functionality required by aStore.- Author:
- Bip Thelin
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle
Lifecycle.SingleUse
-
-
Field Summary
Fields Modifier and Type Field Description protected ManagermanagerThe Manager with which this Store is associated.protected static StringManagersmThe string manager for this package.protected static StringstoreNameName to register for this Store, used for logging.protected PropertyChangeSupportsupportThe property change support for this component.-
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
-
-
Constructor Summary
Constructors Constructor Description StoreBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(PropertyChangeListener listener)Add a property change listener to this component.protected voiddestroyInternal()Sub-classes implement this method to perform any instance destruction required.String[]expiredKeys()Get only those keys of sessions, that are saved in the Store and are to be expired.ManagergetManager()protected ObjectInputStreamgetObjectInputStream(InputStream is)Create the object input stream to use to read a session from the store.StringgetStoreName()protected voidinitInternal()Sub-classes implement this method to perform any instance initialisation required.voidprocessExpires()Called by our background reaper thread to check if Sessions saved in our store are subject of being expired.voidremovePropertyChangeListener(PropertyChangeListener listener)Remove a property change listener from this component.voidsetManager(Manager manager)Set the Manager with which this Store is associated.protected voidstartInternal()Start this component and implement the requirements ofLifecycleBase.startInternal().protected voidstopInternal()Stop this component and implement the requirements ofLifecycleBase.stopInternal().StringtoString()-
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
-
-
-
-
Field Detail
-
storeName
protected static final String storeName
Name to register for this Store, used for logging.- See Also:
- Constant Field Values
-
support
protected final PropertyChangeSupport support
The property change support for this component.
-
sm
protected static final StringManager sm
The string manager for this package.
-
manager
protected Manager manager
The Manager with which this Store is associated.
-
-
Method Detail
-
getStoreName
public String getStoreName()
- Returns:
- the name for this Store, used for logging.
-
setManager
public void setManager(Manager manager)
Set the Manager with which this Store is associated.- Specified by:
setManagerin interfaceStore- Parameters:
manager- The newly associated Manager
-
getManager
public Manager getManager()
- Specified by:
getManagerin interfaceStore- Returns:
- the Manager with which the Store is associated.
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this component.- Specified by:
addPropertyChangeListenerin interfaceStore- Parameters:
listener- a value of typePropertyChangeListener
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component.- Specified by:
removePropertyChangeListenerin interfaceStore- Parameters:
listener- The listener to remove
-
expiredKeys
public String[] expiredKeys() throws IOException
Get only those keys of sessions, that are saved in the Store and are to be expired.- Returns:
- list of session keys, that are to be expired
- Throws:
IOException- if an input-/output error occurred
-
processExpires
public void processExpires()
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.
-
getObjectInputStream
protected ObjectInputStream getObjectInputStream(InputStream is) throws IOException
Create the object input stream to use to read a session from the store. Sub-classes must have set the thread context class loader before calling this method.- Parameters:
is- The input stream provided by the sub-class that will provide the data for a session- Returns:
- An appropriately configured ObjectInputStream from which the session can be read.
- Throws:
IOException- if a problem occurs creating the ObjectInputStream
-
initInternal
protected void initInternal()
Description copied from class:LifecycleBaseSub-classes implement this method to perform any instance initialisation required.- Specified by:
initInternalin classLifecycleBase
-
startInternal
protected void startInternal() throws LifecycleExceptionStart this component and implement the requirements ofLifecycleBase.startInternal().- Specified by:
startInternalin classLifecycleBase- Throws:
LifecycleException- if this component detects a fatal error that prevents this component from being used
-
stopInternal
protected void stopInternal() throws LifecycleExceptionStop this component and implement the requirements ofLifecycleBase.stopInternal().- Specified by:
stopInternalin classLifecycleBase- Throws:
LifecycleException- if this component detects a fatal error that prevents this component from being used
-
destroyInternal
protected void destroyInternal()
Description copied from class:LifecycleBaseSub-classes implement this method to perform any instance destruction required.- Specified by:
destroyInternalin classLifecycleBase
-
-