Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

WebLogic Server 5.1.0sp9 API Reference

## bea.jolt.pool
Class SessionPoolManager

    java.lang.Object
      |
      +--java.util.Dictionary
            |
            +--java.util.Hashtable
                  |
                  +--bea.jolt.pool.SessionPoolManager

Direct Known Subclasses:
  ServletSessionPoolManager

public class SessionPoolManager
extends java.util.Hashtable

This class manages a collection of one or more session pools. It provides some methods that are used to configure both the session pool manager and the session pools that it contains. These methods are part of the administrative API for a session pool. When session pools are being used with BEA WebLogic Application Server, configuration is done via the BEA WebLogic system properties file and the BEA WebLogic management console. A user does not need to access the adminstrative API directly. Refer to the BEA WebLogic Administrators Guide for information on configuring a session pool manager in a BEA WebLogic environment.

The `getSessionPool` method is used to locate a session pool. This method is not part of the administrative API, it is used to submit a request to a BEA TUXEDO system.

A session pool is a set of connections to a BEA TUXEDO system. Each session pool is assigned a name when it is created; this name is used to identify each session pool in the SessionPoolManager. The SessionPoolManager allows one unnamed session pool to be created. This unnamed pool is assigned a default internal name, and can be accessed by using a `null` value for `name`. If there is only one session pool in the SessionPoolManager, this provides a convenient way to access it.

The following list shows a typical life-cycle of a SessionPoolManager:

- Create a SessionPoolManager and store a reference to it. This would usually be done when the application is started.
- Create one or more session pools in the SessionPoolManager. This would also normally be done when the application is started.
- Start receiving client requests (HTTP POST or GET requests)
- For each client request that is received
  - Locate the SessionPoolManager
  - Locate a session pool from the SessionPoolManager (using its name)
  - Submit a service call on the session pool, and get the result
  - Send a response back to the client
- The servlet application is shut down.
- Disconnect the session pools.
- Release the reference to the SessionPoolManager.

When session pools are used in a BEA WebLogic server, the start up and shut down steps of the lifecycle are handled automatically by setting administrative properties in the WebLogic system properties file.

There is generally no need to have more than one instance of a `SessionPoolManager` per application.

Author:
  Copyright (c) 1999 by BEA Systems, Inc. All Rights Reserved.
  Copyright © 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
  `POOLMANAGER_NAME`, Serialized Form

Field Summary
`static java.lang.String` | `POOLMANAGER_NAME` The JNDI entry name for the SessionPoolManager.

Constructor Summary
`SessionPoolManager()` Creates a default `SessionPoolManager` object with an initial capacity of 10.

Method Summary
`protected int` | `createSession(java.lang.String[] addrs, UserInfo usr, java.lang.String id)` This method is part of the SessionPool administrative API.
`int` | `createSessionPool(java.lang.String[] addrs, java.lang.String[] saddrs, int minCons, int maxCons, UserInfo usr, java.lang.String id)` This method is part of the session pool administrative API.
`void` | `done()` This method is part of the session pool administrative API.
`SessionPool` | `getSessionPool(java.lang.String id)` Returns a named session pool.
`protected void` | `log(java.lang.String msg)` Logs an error message.
`protected SessionPool` | `newSessionPool(java.lang.String[] addrs, java.lang.String[] saddrs, int minCons, int maxCons, UserInfo usr, boolean keepAlive)` A default method to create the session.
`void` | `removeSessionPool(java.lang.String id)` This method is part of the session pool administrative API.
`void` | `stopSessionPool(java.lang.String id)` This method is part of the session pool administrative API.
`void` | `suspendSessionPool(java.lang.String id, boolean action)` This method is part of the session pool administrative API.

Methods inherited from class java.util.Hashtable
`clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### POOLMANAGER_NAME

    public static final java.lang.String POOLMANAGER_NAME

  The JNDI entry name for the SessionPoolManager. When session pools are being used with the BEA WebLogic Application Server, the session pool manager is created at startup and is registered in JNDI using this name.

  The following code retrieves the session pool manager via JNDI:

       SessionPoolManager mgr;
       try
       {
      	Context ctx = (new Environment()).getInitialContext();
      	mgr = (SessionPoolManager) ctx.lookup(SessionPoolManager.POOLMANAGER_NAME);
       }
       catch (NamingException e)
       {
      	// handle error
       }

Constructor Detail

### SessionPoolManager

    public SessionPoolManager()

  Creates a default `SessionPoolManager` object with an initial capacity of 10.

Method Detail

### done

    public final void done()

  This method is part of the session pool administrative API. Causes all session pools in this `SessionPoolManager` to be stopped immediately. Any in-process requests in any session pools are terminated. Exceptions are thrown for any outstanding or new requests.

  See Also:
    `stopSessionPool(java.lang.String)`, `suspendSessionPool(java.lang.String, boolean)`, `removeSessionPool(java.lang.String)`

### createSessionPool

    public final int createSessionPool(java.lang.String[] addrs,
                                       java.lang.String[] saddrs,
                                       int minCons,
                                       int maxCons,
                                       UserInfo usr,
                                       java.lang.String id)

  This method is part of the session pool administrative API. Creates a pool of connections to a BEA TUXEDO system.

  A session pool is a set of connections to a BEA TUXEDO system. The array `addrs` is a list of primary machine names and ports used to create the connections. The array `saddrs` is a list of secondary machine names and ports. If any connections to the primary machines fail, the session pool attempts to reconnect using the secondary list of addresses. The parameters `minCons` and `maxCons` represent the minimum and maximum number of connections to be established in the session pool. When the session pool is created, `minCons` connections are established. As load increases, the number of connections are increased up to `maxCons`. The `usr` parameter contains information such as the user name and the password that is used to connect to a BEA TUXEDO system. If no BEA TUXEDO authentication is required, this parameter should be `null`. The session pool is identified by `id`. If `id` is `null`, a default name is used to identify the session pool; to access this default session pool, always specify `null` as the `id`.

  There can only be one session pool with a given name (including the default) at any time. Multiple calls to this method with the same `id` cause the existing session pool named `id` to be discarded by the session pool manager and replaced with a new session pool named `id`. The behavior of the original session pool is non-deterministic; the pool should not be used. All references to the original session pool should be discarded.

  This method returns the number of successful connections. This should be the same as `minCons`.

  Parameters:
    `addrs` - List of primary server addresses
    `saddrs` - List of secondary server addresses for failover
    `minCons` - Minimum number of connections to start with
    `maxCons` - Maximum number of connections in this pool
    `usr` - BEA TUXEDO authentication information, or null
    `id` - ID to identify the session pool, or `null` for default session pool
  Returns:
    Number of successful connections
  See Also:
    `getSessionPool(java.lang.String)`

### createSession

    protected final int createSession(java.lang.String[] addrs,
                                      UserInfo usr,
                                      java.lang.String id)

  This method is part of the SessionPool administrative API. Creates a connection-oriented session to BEA Jolt server with a single connection. It is designed to be used exclusively by a client. The session is dead if its connection is terminated. The session manager automatically cleans up the dead session.

  This method should not be documented.

  Parameters:
    `addrs` - List of server addresses
    `usr` - BEA TUXEDO authentication information, or null
    `id` - Unique client id specified by the caller
  Returns:
    Number of successful connection

### suspendSessionPool

    public final void suspendSessionPool(java.lang.String id,
                                         boolean action)

  This method is part of the session pool administrative API. It suspends an active session pool, or resumes a suspended session pool. When a session pool is suspended, it is put in a mode where it does not accept any new requests. Requests that have already been dispatched to the session pool complete normally. When a session pool is resumed, it is restored to a mode where it accepts new requests. This method allows an administrator to shut down a session pool gracefully. When there are no outstanding requests in the session pool, the pool can be stopped. `id` identifies the session pool to suspend or resume. It must match the id used in the `createSessionPool` method to create the session pool.

  Parameters:
    `id` - ID to identify the session pool, or `null` for default session pool
    `action` - True to suspend the session pool, false to resume it.
  See Also:
    `createSessionPool(java.lang.String[], java.lang.String[], int, int, bea.jolt.pool.UserInfo, java.lang.String)`, `stopSessionPool(java.lang.String)`, `removeSessionPool(java.lang.String)`, `done()`

### stopSessionPool

    public final void stopSessionPool(java.lang.String id)

  This method is part of the session pool administrative API. Stops the session pool immediately. All active connections in the session pool are terminated. Any in-process requests in the session pool are terminated. Exceptions are thrown for outstanding or new requests. `id` identifies the session pool to stop. It must match the id used in the `createSessionPool` method to create the session pool.

  Parameters:
    `id` - ID to identify the session pool, or `null` for default session pool
  See Also:
    `createSessionPool(java.lang.String[], java.lang.String[], int, int, bea.jolt.pool.UserInfo, java.lang.String)`, `suspendSessionPool(java.lang.String, boolean)`, `removeSessionPool(java.lang.String)`, `done()`

### removeSessionPool

    public final void removeSessionPool(java.lang.String id)

  This method is part of the session pool administrative API. Shuts down the session pool and removes it from the SessionPoolManager. All active connections in this session pool are terminated immediately. Any in-process requests in the session pool are terminated. Exceptions are thrown for outstanding or new requests. `id` identifies the session pool to remove. It must match the id used in the `createSessionPool` method to create the session pool.

  Parameters:
    `id` - ID to identify the session pool, or `null` for default session pool
  See Also:
    `createSessionPool(java.lang.String[], java.lang.String[], int, int, bea.jolt.pool.UserInfo, java.lang.String)`, `suspendSessionPool(java.lang.String, boolean)`, `stopSessionPool(java.lang.String)`, `done()`

### getSessionPool

    public final SessionPool getSessionPool(java.lang.String id)

  Returns a named session pool. `id` identifies the session pool to return. It must match the id used in the `createSessionPool` method to create the session pool. If `id` does not match the name of a session pool, this method returns `null`. Refer to the BEA WebLogic Administrators Guide for information on creating and naming a SessionPool.

  Parameters:
    `id` - ID that identifies the session pool, or `null` for the default session pool
  Returns:
    A SessionPool or `null`
  See Also:
    `createSessionPool(java.lang.String[], java.lang.String[], int, int, bea.jolt.pool.UserInfo, java.lang.String)`

### newSessionPool

    protected SessionPool newSessionPool(java.lang.String[] addrs,
                                         java.lang.String[] saddrs,
                                         int minCons,
                                         int maxCons,
                                         UserInfo usr,
                                         boolean keepAlive)

  A default method to create the session. This method should be overridden, so a web-server specific session pool object can be created.

  Parameters:
    `addrs` - List server addresss
    `saddrs` - List secondary server addresss for failover
    `minCons` - Minimum number of connections
    `maxCons` - Maximum number of connections
    `usr` - User authentication information, or null
    `keepAlive` - true for reconnection, false for no reconnection.
  Returns:
    A session pool object

### log

    protected void log(java.lang.String msg)

  Logs an error message. This method should be overridden, so a web-server specific session manager can provide its logging facility.

  Parameters:
    `msg` - Error message to be logged.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://www.weblogic.com/docs51
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD