Sun Java System Web Server 6.1 SP9 Programmer's Guide to Web Applications

PersistentManager

The PersistentManager is another session manager provided with Sun Java System Web Server. For session persistence, PersistentManager can use a file, to which each session is serialized. You can also create your own persistence mechanism.

Enabling PersistentManager

You may want to specify PersistentManager explicitly to change its default parameters. To do so, edit the sun-web.xml file for the web application as in the following example. Note that persistence-type must be set to file.

<sun-web-app>
        ...
        <session-config>
           <session-manager persistence-type=”file”>
              <manager-properties>
                 <property name=reapIntervalSeconds value=20 >
              </manager-properties>
              <store-properties>
                 <property name=directory value=sessions >
              </store-properties>
           </session-manage>
           ...
        </session-config>
        ...
</sun-web-app>

For more information about the sun-web.xml file, Chapter 7, Deploying Web Applications.

Manager Properties for PersistentManager

The following table describes manager-properties properties for the PersistentManager session manager. The left column lists the property name, the middle column indicates the default value, and the right column describes what the property does.

Table 4–5 manager-properties Properties for PersistentManager

Property Name  

Default Value  

Description  

reapIntervalSeconds

60

Specifies the number of seconds between checks for expired sessions. 

Setting this value lower than the frequency at which session data changes is recommended. For example, this value should be as low as possible (1 second) for a hit counter servlet on a frequently accessed web site, or you could lose the last few hits each time you restart the server. 

maxSessions

-1 

Specifies the maximum number of active sessions, or -1 (the default) for no limit.