Fields Summary |
---|
protected String | infoThe descriptive information about this implementation. |
protected String | storeNameName to register for this Store, used for logging. |
protected int | debugThe debugging detail level for this component. |
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 static final 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 void | doProcessExpires()public wrapper for processExpires()
don't want to make processExpires() public
called from manager background thread
Hercules: added method
this.processExpires();
|
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 int | getDebug()Return the debugging detail level for this Store.
return(this.debug);
|
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 org.apache.catalina.Session | load(java.lang.String id, java.lang.String version)Load and return the Session associated with the specified session
identifier from this Store, without removing it. If there is no
such stored Session, return null .
return load(id);
|
protected void | log(java.lang.String message)Log a message on the Logger associated with our Container (if any).
Logger logger = null;
Container container = manager.getContainer();
if (container != null) {
logger = container.getLogger();
}
if (logger != null) {
logger.log(getStoreName()+"[" + container.getName() + "]: "
+ message);
} else {
String containerName = null;
if (container != null) {
containerName = container.getName();
}
System.out.println(getStoreName()+"[" + containerName
+ "]: " + message);
}
|
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) {
log (e.toString());
e.printStackTrace();
return;
}
for (int i = 0; i < keys.length; i++) {
try {
StandardSession session = (StandardSession) load(keys[i]);
if (session == null) {
continue;
}
if (session.isValid()) {
continue;
}
if ( ( (PersistentManagerBase) manager).isLoaded( keys[i] )) {
// recycle old backup session
session.recycle();
} else {
// expire swapped out session
session.expire();
}
remove(session.getIdInternal());
} catch (IOException e) {
log (e.toString());
e.printStackTrace();
} catch (ClassNotFoundException e) {
log (e.toString());
e.printStackTrace();
}
}
|
public org.apache.catalina.Session | readSession(org.apache.catalina.Manager manager, java.io.ObjectInputStream ois)Create a session object from an input stream.
StandardSession sess = StandardSession.deserialize(ois, manager);
sess.setManager(manager);
return sess;
|
public void | removeFromStoreCache(java.lang.String id)no-op method - sub classes will
implement to remove a session from the store
cache
Hercules: added method
//do nothing
|
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 | setDebug(int debug)Set the debugging detail level for this Store.
this.debug = debug;
|
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;
|
public void | writeSession(org.apache.catalina.Session sess, java.io.ObjectOutputStream oos)Serialize a session into an output stream.
if ( sess == null ) {
return;
}
oos.writeObject(sess);
|