| Method from org.apache.catalina.session.StoreBase Detail: |
public void addLifecycleListener(LifecycleListener listener) {
lifecycle.addLifecycleListener(listener);
}
Add a lifecycle event listener to this component. |
public void addPropertyChangeListener(PropertyChangeListener listener) {
support.addPropertyChangeListener(listener);
}
Add a property change listener to this component. |
public LifecycleListener[] findLifecycleListeners() {
return lifecycle.findLifecycleListeners();
}
Get the lifecycle listeners associated with this lifecycle. If this
Lifecycle has no listeners registered, a zero-length array is returned. |
public String getInfo() {
// ------------------------------------------------------------- Properties
return(info);
}
Return the info for this Store. |
public Manager getManager() {
return(this.manager);
}
Return the Manager with which the Store is associated. |
public String getStoreName() {
return(storeName);
}
Return the name for this Store, used for logging. |
public void processExpires() {
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);
}
}
}
}
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. |
public void removeLifecycleListener(LifecycleListener listener) {
lifecycle.removeLifecycleListener(listener);
}
Remove a lifecycle event listener from this component. |
public void removePropertyChangeListener(PropertyChangeListener listener) {
support.removePropertyChangeListener(listener);
}
Remove a property change listener from this component. |
public void setManager(Manager manager) {
Manager oldManager = this.manager;
this.manager = manager;
support.firePropertyChange("manager", oldManager, this.manager);
}
Set the Manager with which this Store is associated. |
public void start() throws LifecycleException {
// Validate and update our current component state
if (started)
throw new LifecycleException
(sm.getString(getStoreName()+".alreadyStarted"));
lifecycle.fireLifecycleEvent(START_EVENT, null);
started = true;
}
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. |
public void stop() throws LifecycleException {
// Validate and update our current component state
if (!started)
throw new LifecycleException
(sm.getString(getStoreName()+".notStarted"));
lifecycle.fireLifecycleEvent(STOP_EVENT, null);
started = false;
}
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. |