Java Doc for PersistentManagerBase.java in  » Web-Server » Rimfaxe-Web-Server » org » apache » catalina » session » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » Rimfaxe Web Server » org.apache.catalina.session 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.catalina.session.ManagerBase
      org.apache.catalina.session.PersistentManagerBase

All known Subclasses:   org.apache.catalina.session.PersistentManager,  org.apache.catalina.session.DistributedManager,
PersistentManagerBase
abstract public class PersistentManagerBase extends ManagerBase implements Lifecycle,PropertyChangeListener,Runnable(Code)
Extends the ManagerBase class to implement most of the functionality required by a Manager which supports any kind of persistence, even if onlyfor restarts.

IMPLEMENTATION NOTE: Correct behavior of session storing and reloading depends upon external calls to the start() and stop() methods of this class at the correct times.
author:
   Craig R. McClanahan
version:
   $Revision: 1.8 $ $Date: 2002/06/09 02:19:43 $



Field Summary
protected  LifecycleSupportlifecycle
     The lifecycle event support for this component.
protected static  Stringname
     The descriptive name of this Manager implementation (for logging).
protected  booleanthreadDone
     The background thread completion semaphore.


Method Summary
public  voidaddLifecycleListener(LifecycleListener listener)
     Add a lifecycle event listener to this component.
public  voidclearStore()
     Clear all sessions from the Store.
public  SessioncreateSession()
     Return a new session object as long as the number of active sessions does not exceed maxActiveSessions.
public  LifecycleListener[]findLifecycleListeners()
     Get the lifecycle listeners associated with this lifecycle.
public  SessionfindSession(String id)
     Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null.
public  intgetCheckInterval()
     Return the check interval (in seconds) for this Manager.
public  StringgetInfo()
     Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.
public  intgetMaxActiveSessions()
     Return the maximum number of active Sessions allowed, or -1 for no limit.
public  intgetMaxIdleBackup()
     Indicates how many seconds old a session can get, after its last use in a request, before it should be backed up to the store.
public  intgetMaxIdleSwap()
     The time in seconds after which a session should be swapped out of memory to disk.
public  intgetMinIdleSwap()
     The minimum time in seconds that a session must be idle before it can be swapped out of memory, or -1 if it can be swapped out at any time.
public  StringgetName()
     Return the descriptive short name of this Manager implementation.
public  booleangetSaveOnRestart()
     Indicates whether sessions are saved when the Manager is shut down properly.
public  StoregetStore()
     Return the Store object which manages persistent Session storage for this Manager.
protected  booleanisSessionStale(Session session, long timeNow)
     Indicate whether the session has been idle for longer than its expiration date as of the supplied time.
protected  booleanisStarted()
     Get the started status.
public  voidload()
     Load all sessions found in the persistence mechanism, assuming they are marked as valid and have not passed their expiration limit.
protected  voidprocessExpires()
     Invalidate all sessions that have expired.
protected  voidprocessMaxActiveSwaps()
    
protected  voidprocessMaxIdleBackups()
     Back up idle sessions.
protected  voidprocessMaxIdleSwaps()
     Swap idle sessions out to Store if they are idle too long.
public  voidprocessPersistenceChecks()
     Called by the background thread after active sessions have been checked for expiration, to allow sessions to be swapped out, backed up, etc.
public  voidpropertyChange(PropertyChangeEvent event)
     Process property change events from our associated Context.
public  voidremove(Session session)
     Remove this Session from the active Sessions for this Manager, and from the Store.
public  voidremoveLifecycleListener(LifecycleListener listener)
     Remove a lifecycle event listener from this component.
public  voidrun()
     The background thread that checks for session timeouts and shutdown.
public  voidsetCheckInterval(int checkInterval)
     Set the check interval (in seconds) for this Manager.
public  voidsetContainer(Container container)
     Set the Container with which this Manager has been associated.
public  voidsetMaxActiveSessions(int max)
     Set the maximum number of actives Sessions allowed, or -1 for no limit.
public  voidsetMaxIdleBackup(int backup)
     Sets the option to back sessions up to the Store after they are used in a request.
public  voidsetMaxIdleSwap(int max)
     Sets the time in seconds after which a session should be swapped out of memory to disk.
public  voidsetMinIdleSwap(int min)
     Sets the minimum time in seconds that a session must be idle before it can be swapped out of memory due to maxActiveSession.
public  voidsetSaveOnRestart(boolean saveOnRestart)
     Set the option to save sessions to the Store when the Manager is shut down, then loaded when the Manager starts again.
protected  voidsetStarted(boolean started)
    
public  voidsetStore(Store store)
     Set the Store object which will manage persistent Session storage for this Manager.
public  voidstart()
     Prepare for the beginning of active use of the public methods of this component.
public  voidstop()
     Gracefully terminate the active use of the public methods of this component.
protected  SessionswapIn(String id)
     Look for a session in the Store and, if found, restore it in the Manager's list of active sessions if appropriate.
protected  voidswapOut(Session session)
     Remove the session from the Manager's list of active sessions and write it out to the Store.
protected  voidthreadSleep()
     Sleep for the duration specified by the checkInterval property.
protected  voidthreadStart()
     Start the background thread that will periodically check for session timeouts.
protected  voidthreadStop()
     Stop the background thread that is periodically checking for session timeouts.
public  voidunload()
     Save all currently active sessions in the appropriate persistence mechanism, if any.
protected  voidwriteSession(Session session)
     Write the provided session to the Store without modifying the copy in memory or triggering passivation events.

Field Detail
lifecycle
protected LifecycleSupport lifecycle(Code)
The lifecycle event support for this component.



name
protected static String name(Code)
The descriptive name of this Manager implementation (for logging).



threadDone
protected boolean threadDone(Code)
The background thread completion semaphore.





Method Detail
addLifecycleListener
public void addLifecycleListener(LifecycleListener listener)(Code)
Add a lifecycle event listener to this component.
Parameters:
  listener - The listener to add



clearStore
public void clearStore()(Code)
Clear all sessions from the Store.



createSession
public Session createSession()(Code)
Return a new session object as long as the number of active sessions does not exceed maxActiveSessions. If there aren't too many active sessions, or if there is no limit, a session is created or retrieved from the recycled pool.
exception:
  IllegalStateException - if a new session cannot beinstantiated for any reason



findLifecycleListeners
public LifecycleListener[] findLifecycleListeners()(Code)
Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.



findSession
public Session findSession(String id) throws IOException(Code)
Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null. This method checks the persistence store if persistence is enabled, otherwise just uses the functionality from ManagerBase.
Parameters:
  id - The session id for the session to be returned
exception:
  IllegalStateException - if a new session cannot beinstantiated for any reason
exception:
  IOException - if an input/output error occurs whileprocessing this request



getCheckInterval
public int getCheckInterval()(Code)
Return the check interval (in seconds) for this Manager.



getInfo
public String getInfo()(Code)
Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.



getMaxActiveSessions
public int getMaxActiveSessions()(Code)
Return the maximum number of active Sessions allowed, or -1 for no limit.



getMaxIdleBackup
public int getMaxIdleBackup()(Code)
Indicates how many seconds old a session can get, after its last use in a request, before it should be backed up to the store. -1 means sessions are not backed up.



getMaxIdleSwap
public int getMaxIdleSwap()(Code)
The time in seconds after which a session should be swapped out of memory to disk.



getMinIdleSwap
public int getMinIdleSwap()(Code)
The minimum time in seconds that a session must be idle before it can be swapped out of memory, or -1 if it can be swapped out at any time.



getName
public String getName()(Code)
Return the descriptive short name of this Manager implementation.



getSaveOnRestart
public boolean getSaveOnRestart()(Code)
Indicates whether sessions are saved when the Manager is shut down properly. This requires the unload() method to be called.



getStore
public Store getStore()(Code)
Return the Store object which manages persistent Session storage for this Manager.



isSessionStale
protected boolean isSessionStale(Session session, long timeNow)(Code)
Indicate whether the session has been idle for longer than its expiration date as of the supplied time. FIXME: Probably belongs in the Session class.



isStarted
protected boolean isStarted()(Code)
Get the started status.



load
public void load()(Code)
Load all sessions found in the persistence mechanism, assuming they are marked as valid and have not passed their expiration limit. If persistence is not supported, this method returns without doing anything.

Note that by default, this method is not called by the MiddleManager class. In order to use it, a subclass must specifically call it, for example in the start() and/or processPersistenceChecks() methods.




processExpires
protected void processExpires()(Code)
Invalidate all sessions that have expired.



processMaxActiveSwaps
protected void processMaxActiveSwaps()(Code)
Swap idle sessions out to Store if too many are active



processMaxIdleBackups
protected void processMaxIdleBackups()(Code)
Back up idle sessions.



processMaxIdleSwaps
protected void processMaxIdleSwaps()(Code)
Swap idle sessions out to Store if they are idle too long.



processPersistenceChecks
public void processPersistenceChecks()(Code)
Called by the background thread after active sessions have been checked for expiration, to allow sessions to be swapped out, backed up, etc.



propertyChange
public void propertyChange(PropertyChangeEvent event)(Code)
Process property change events from our associated Context.
Parameters:
  event - The property change event that has occurred



remove
public void remove(Session session)(Code)
Remove this Session from the active Sessions for this Manager, and from the Store.
Parameters:
  session - Session to be removed



removeLifecycleListener
public void removeLifecycleListener(LifecycleListener listener)(Code)
Remove a lifecycle event listener from this component.
Parameters:
  listener - The listener to remove



run
public void run()(Code)
The background thread that checks for session timeouts and shutdown.



setCheckInterval
public void setCheckInterval(int checkInterval)(Code)
Set the check interval (in seconds) for this Manager.
Parameters:
  checkInterval - The new check interval



setContainer
public void setContainer(Container container)(Code)
Set the Container with which this Manager has been associated. If it is a Context (the usual case), listen for changes to the session timeout property.
Parameters:
  container - The associated Container



setMaxActiveSessions
public void setMaxActiveSessions(int max)(Code)
Set the maximum number of actives Sessions allowed, or -1 for no limit.
Parameters:
  max - The new maximum number of sessions



setMaxIdleBackup
public void setMaxIdleBackup(int backup)(Code)
Sets the option to back sessions up to the Store after they are used in a request. Sessions remain available in memory after being backed up, so they are not passivated as they are when swapped out. The value set indicates how old a session may get (since its last use) before it must be backed up: -1 means sessions are not backed up.

Note that this is not a hard limit: sessions are checked against this age limit periodically according to checkInterval. This value should be considered to indicate when a session is ripe for backing up.

So it is possible that a session may be idle for maxIdleBackup + checkInterval seconds, plus the time it takes to handle other session expiration, swapping, etc. tasks.
Parameters:
  backup - The number of seconds after their last accessedtime when they should be written to the Store.




setMaxIdleSwap
public void setMaxIdleSwap(int max)(Code)
Sets the time in seconds after which a session should be swapped out of memory to disk.



setMinIdleSwap
public void setMinIdleSwap(int min)(Code)
Sets the minimum time in seconds that a session must be idle before it can be swapped out of memory due to maxActiveSession. Set it to -1 if it can be swapped out at any time.



setSaveOnRestart
public void setSaveOnRestart(boolean saveOnRestart)(Code)
Set the option to save sessions to the Store when the Manager is shut down, then loaded when the Manager starts again. If set to false, any sessions found in the Store may still be picked up when the Manager is started again.
Parameters:
  save - true if sessions should be saved on restart, false ifthey should be ignored.



setStarted
protected void setStarted(boolean started)(Code)
Set the started flag



setStore
public void setStore(Store store)(Code)
Set the Store object which will manage persistent Session storage for this Manager.
Parameters:
  store - the associated Store



start
public void start() throws LifecycleException(Code)
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.
exception:
  LifecycleException - if this component detects a fatal errorthat prevents this component from being used



stop
public void stop() throws LifecycleException(Code)
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.
exception:
  LifecycleException - if this component detects a fatal errorthat needs to be reported



swapIn
protected Session swapIn(String id) throws IOException(Code)
Look for a session in the Store and, if found, restore it in the Manager's list of active sessions if appropriate. The session will be removed from the Store after swapping in, but will not be added to the active session list if it is invalid or past its expiration.



swapOut
protected void swapOut(Session session) throws IOException(Code)
Remove the session from the Manager's list of active sessions and write it out to the Store. If the session is past its expiration or invalid, this method does nothing.
Parameters:
  session - The Session to write out.



threadSleep
protected void threadSleep()(Code)
Sleep for the duration specified by the checkInterval property.



threadStart
protected void threadStart()(Code)
Start the background thread that will periodically check for session timeouts.



threadStop
protected void threadStop()(Code)
Stop the background thread that is periodically checking for session timeouts.



unload
public void unload()(Code)
Save all currently active sessions in the appropriate persistence mechanism, if any. If persistence is not supported, this method returns without doing anything.

Note that by default, this method is not called by the MiddleManager class. In order to use it, a subclass must specifically call it, for example in the stop() and/or processPersistenceChecks() methods.




writeSession
protected void writeSession(Session session) throws IOException(Code)
Write the provided session to the Store without modifying the copy in memory or triggering passivation events. Does nothing if the session is invalid or past its expiration.



Fields inherited from org.apache.catalina.session.ManagerBase
final protected static String DEFAULT_ALGORITHM(Code)(Java Doc)
final protected static int SESSION_ID_BYTES(Code)(Java Doc)
protected String algorithm(Code)(Java Doc)
protected Container container(Code)(Java Doc)
protected int debug(Code)(Java Doc)
protected MessageDigest digest(Code)(Java Doc)
protected boolean distributable(Code)(Java Doc)
protected String entropy(Code)(Java Doc)
protected int maxInactiveInterval(Code)(Java Doc)
protected static String name(Code)(Java Doc)
protected Random random(Code)(Java Doc)
protected String randomClass(Code)(Java Doc)
protected ArrayList recycled(Code)(Java Doc)
protected HashMap sessions(Code)(Java Doc)
protected static StringManager sm(Code)(Java Doc)
protected PropertyChangeSupport support(Code)(Java Doc)

Methods inherited from org.apache.catalina.session.ManagerBase
public void add(Session session)(Code)(Java Doc)
public void addPropertyChangeListener(PropertyChangeListener listener)(Code)(Java Doc)
public Session createSession()(Code)(Java Doc)
public Session findSession(String id) throws IOException(Code)(Java Doc)
public Session[] findSessions()(Code)(Java Doc)
protected synchronized String generateSessionId()(Code)(Java Doc)
public String getAlgorithm()(Code)(Java Doc)
public Container getContainer()(Code)(Java Doc)
public int getDebug()(Code)(Java Doc)
public synchronized MessageDigest getDigest()(Code)(Java Doc)
public boolean getDistributable()(Code)(Java Doc)
public Engine getEngine()(Code)(Java Doc)
public String getEntropy()(Code)(Java Doc)
public String getInfo()(Code)(Java Doc)
public String getJvmRoute()(Code)(Java Doc)
public int getMaxInactiveInterval()(Code)(Java Doc)
public String getName()(Code)(Java Doc)
public synchronized Random getRandom()(Code)(Java Doc)
public String getRandomClass()(Code)(Java Doc)
void log(String message)(Code)(Java Doc)
void log(String message, Throwable throwable)(Code)(Java Doc)
void recycle(Session session)(Code)(Java Doc)
public void remove(Session session)(Code)(Java Doc)
public void removePropertyChangeListener(PropertyChangeListener listener)(Code)(Java Doc)
public void setAlgorithm(String algorithm)(Code)(Java Doc)
public void setContainer(Container container)(Code)(Java Doc)
public void setDebug(int debug)(Code)(Java Doc)
public void setDistributable(boolean distributable)(Code)(Java Doc)
public void setEntropy(String entropy)(Code)(Java Doc)
public void setMaxInactiveInterval(int interval)(Code)(Java Doc)
public void setRandomClass(String randomClass)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.