Fields Summary |
---|
protected static String | infoThe descriptive information about this implementation. |
protected static String | storeNameName to register for this Store, used for logging. |
protected boolean | startedHas this component been started yet? |
protected org.apache.catalina.util.LifecycleSupport | lifecycleThe lifecycle event support for this component. |
protected PropertyChangeSupport | supportThe property change support for this component. |
protected org.apache.catalina.util.StringManager | smThe string manager for this package. |
protected org.apache.catalina.Manager | managerThe Manager with which this JDBCStore is associated. |
Methods Summary |
---|
public void | addLifecycleListener(org.apache.catalina.LifecycleListener listener)Add a lifecycle event listener to this component.
lifecycle.addLifecycleListener(listener);
|
public void | addPropertyChangeListener(java.beans.PropertyChangeListener listener)Add a property change listener to this component.
support.addPropertyChangeListener(listener);
|
public org.apache.catalina.LifecycleListener[] | findLifecycleListeners()Get the lifecycle listeners associated with this lifecycle. If this
Lifecycle has no listeners registered, a zero-length array is returned.
return lifecycle.findLifecycleListeners();
|
public java.lang.String | getInfo()Return the info for this Store.
// ------------------------------------------------------------- Properties
return(info);
|
public org.apache.catalina.Manager | getManager()Return the Manager with which the Store is associated.
return(this.manager);
|
public java.lang.String | getStoreName()Return the name for this Store, used for logging.
return(storeName);
|
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.
long timeNow = System.currentTimeMillis();
String[] keys = null;
if(!started) {
return;
}
try {
keys = keys();
} catch (IOException e) {
manager.getContainer().getLogger().error("Error getting keys", e);
return;
}
if (manager.getContainer().getLogger().isDebugEnabled()) {
manager.getContainer().getLogger().debug(getStoreName()+ ": processExpires check number of " + keys.length + " sessions" );
}
for (int i = 0; i < keys.length; i++) {
try {
StandardSession session = (StandardSession) load(keys[i]);
if (session == null) {
continue;
}
if (session.isValid()) {
continue;
}
if (manager.getContainer().getLogger().isDebugEnabled()) {
manager.getContainer().getLogger().debug(getStoreName()+ ": processExpires expire store session " + keys[i] );
}
if ( ( (PersistentManagerBase) manager).isLoaded( keys[i] )) {
// recycle old backup session
session.recycle();
} else {
// expire swapped out session
session.expire();
}
remove(session.getIdInternal());
} catch (Exception e) {
manager.getContainer().getLogger().error("Session: "+keys[i]+"; ", e);
try {
remove(keys[i]);
} catch (IOException e2) {
manager.getContainer().getLogger().error("Error removing key", e2);
}
}
}
|
public void | removeLifecycleListener(org.apache.catalina.LifecycleListener listener)Remove a lifecycle event listener from this component.
lifecycle.removeLifecycleListener(listener);
|
public void | removePropertyChangeListener(java.beans.PropertyChangeListener listener)Remove a property change listener from this component.
support.removePropertyChangeListener(listener);
|
public void | setManager(org.apache.catalina.Manager manager)Set the Manager with which this Store is associated.
Manager oldManager = this.manager;
this.manager = manager;
support.firePropertyChange("manager", oldManager, this.manager);
|
public void | start()Prepare for the beginning of active use of the public methods of this
component. This method should be called after configure() ,
and before any of the public methods of the component are utilized.
// Validate and update our current component state
if (started)
throw new LifecycleException
(sm.getString(getStoreName()+".alreadyStarted"));
lifecycle.fireLifecycleEvent(START_EVENT, null);
started = true;
|
public void | stop()Gracefully terminate the active use of the public methods of this
component. This method should be the last one called on a given
instance of this component.
// Validate and update our current component state
if (!started)
throw new LifecycleException
(sm.getString(getStoreName()+".notStarted"));
lifecycle.fireLifecycleEvent(STOP_EVENT, null);
started = false;
|