6.3.2 Deleting global session information
Validity of global session information is monitored by monitoring HTTP sessions on a J2EE server. As a part of monitoring validity, the global session information on the database is deleted for HTTP sessions for which the validity of has expired. However, if a J2EE server stops due to a failure, the global session information used on that server is inherited on another J2EE server or the validity is not monitored until you restart the J2EE server. If the state of not monitoring the validity continues for a long time, the global session information, which is not deleted even if validity has elapsed, continues using records in the session information storage table.
Therefore, you must appropriately delete the global session information remaining in the database.
The following subsection describes how to delete global session information by using a command:
-
For deleting the global session information
Use the cjclearsession command for deleting the global session information. Execute the command before restarting a J2EE server or a Web application after the J2EE server or a Web application stops, and time exceeding the validity of the HTTP session has elapsed.
In a Web application, if you have set validity for each HTTP session by using Sevlet API, execute the command in accordance with longest validity.
The following are the procedures for deleting global session information:
-
In the environment variable CLASSPATH, set the path of a JDBC driver to be used.
When using the cjclearsession command for the first time, specify a path of the JDBC driver to be used in the environment variable CLASSPATH.
-
Execute the cjclearsession command for deleting the global session information.
Specify the application identifier, server ID, and information of a JDBC driver to be used, and information required for accessing the database with the command, and execute. All the global session information possessed by the J2EE server specified in the server ID of a Web application that is specified in application identifier, is deleted.
-
Restart the J2EE server or a Web application if required.
If you specify the -count option in the cjclearsession command and execute the command, you can view the number of global session information possessed by the J2EE server.
The timeout for connection tries to database and execution timeout of SQL that acquires or deletes the global session information of database is eight seconds.
If an error occurs during database access while executing the command, stop the command execution at the point at which the error occurred.
For details on the cjclearsession command, see cjclearsession (Delete global session information (database session failover functionality)) in the uCosminexus Application Server Command Reference Guide.
-
-
Notes
Notes for deleting global session information:
-
Deleting information when the J2EE server, which owns the HTTP session to be deleted, is running
If the J2EE server is running, request processing might be performed and the global session information might be newly created. As a result, if the J2EE server, which owns the HTTP session to be deleted, is running, the information might be deleted before the validity of the global session expires. When deleting global session information, stop the J2EE server, which owns the HTTP session to be deleted, and then execute the command.
-
Deleting before validity expires
If you delete the global session information by executing the cjclearsession command before the validity of the global session expires, the operations are as follows.
Sr. No.
Integrity mode
Existence status of HTTP session on the J2EE server
Operation
1
Disables
None
You cannot inherit the global session.
2
Yes
Thereafter, the deleted global session information is not stored in the database and a Web application operates only with the HTTP session on the J2EE server.
-
Deleting when integrity mode is enabled
Operation is not guaranteed if the integrity mode is enabled.
-
If using Oracle JDBC Thin Driver
The cjclearsession command implements timeout when executing an SQL by using the setQueryTimeout method of the JDBC driver. For details on the points to be considered when connecting to Oracle by using Oracle JDBC Thin Driver, see 3.6.6 Prerequisites and notes when connecting to Oracle in the uCosminexus Application Server Common Container Functionality Guide.
-