This persistence type provides session persistence to the local file system, and allows a single server domain to recover the session state after a failure and restart. The session state is persisted in the background, and the rate at which this occurs is configurable. The store also provides passivation and activation of the session state to help control the amount of memory used. This option is not supported in a production environment. However, it is useful for a development system with a single server instance.
Make sure the delete option is set in the server.policy file, or expired file-based sessions might not be deleted properly. For more information about server.policy, see The server.policy File.
To specify the file persistence type for the entire web container, use the configure-ha-persistence command. For details, see the Sun GlassFish Enterprise Server 2.1 Reference Manual.
To specify the file persistence type for a specific web application, edit the sun-web.xml file as in the following example. Note that persistence-type must be set to file. This overrides the web container availability settings for the web application.
<sun-web-app> ... <session-config> <session-manager persistence-type="file"> <store-properties> <property name="directory" value="sessiondir" /> </store-properties> </session-manager> ... </session-config> ... </sun-web-app>
The file persistence type supports all the manager properties listed under manager-properties in Sun GlassFish Enterprise Server 2.1 Application Deployment Guide except sessionFilename, and supports the directory store property listed under store-properties in Sun GlassFish Enterprise Server 2.1 Application Deployment Guide.
For more information about the sun-web.xml file, see Sun GlassFish Enterprise Server 2.1 Application Deployment Guide.