3.2.1 Accessing a Servlet Session Pool
Once a WebLogic Server is configured to set up a Jolt session pool on startup, you can access
and use the Jolt session pool from your Java application or servlet. As described earlier, in
the WebLogic Server all ServletSessionPool
objects are managed by the same
ServletSessionPoolManager
.
ServletSessionPoolManager poolMgr = (ServletSessionPoolManager)
SessionPoolManager.poolmanager;
The WebLogic Server uses a ServletSessionPoolManager
class that is derived
from SessionPoolManager
. The ServletSessionPoolManager
manages ServletSessionPool
objects, which offer additional HTTP servlet
methods.
SessionPoolManager
provides several methods for managing the administration
of a session pool. In the following example, the SessionPoolManager
is used
to retrieve the SessionPool
that has been named
joltpoolname
:
SessionPool sPool = poolMgr.getSessionPool("joltpoolname");
However, because the WebLogic Server uses the subclass
ServletSessionPoolManager,
the above example actually returns a
ServletSessionPool
object in the guise of a
SessionPool
.
You must cast the SessionPool
to a ServletSessionPool
, as
in the following code example:
ServletSessionPool ssPool =
(ServletSessionPool) poolMgr.getSessionPool("joltpoolname");
Because WebLogic Server creates and configures the
ServletSessionPoolManager
, it is likely that this is the only method you will
use. Other SessionPoolManager
methods allow you to create, suspend, stop, or
shut down individual or all the session pools it manages. We recommend that you leave these
administrative operations to the WebLogic Server by configuring and managing your session
pools using the WebLogic config.xml
configuration file.
Parent topic: Configuring a Session Pool