Sun Java System Web Server 7.0 Update 2 Developer's Guide to Java Web Applications

memory Option

The memory is the default memory based session manager.

Enabling memory

You can specify memory 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 memory.

<sun-web-app>
         ...
        <session-config>
           <session-manager persistence-type=”memory”>
              <manager-properties>
                 <property name="reapIntervalSeconds" value="20" />
              </manager-properties>
           </session-manager>
            ...
        </session-config>
        ...
</sun-web-app>

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

Manager Properties for Memory

The following table describes manager-properties properties for the memory based session manager.

Table 6–4 manager-properties for memory

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.

sessionFilename

SESSIONS

Specifies the absolute or relative path name of the file in which the session state is preserved between application restarts, if preserving the state is possible. A relative path name is relative to the temporary directory for this web application.