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 SessionPool

    java.lang.Object
      |
      +--bea.jolt.pool.Factory
            |
            +--bea.jolt.pool.SessionPool

Direct Known Subclasses:
  ServletSessionPool

public class SessionPool
extends bea.jolt.pool.Factory

This class represents a session pool that contains one or more connections (sessions) to a BEA TUXEDO system. Service requests are sent to the BEA TUXEDO system via the session pool that distributes requests across its available connections.

This class provides several methods that are part of the session pool administrative API. When using session pools with BEA WebLogic, administration is done via the BEA WebLogic console. A user does not need to access this administrative API directly.

The `call` and `startTransaction` methods are not part of the administrative API. They are used to submit requests to a BEA TUXEDO system.

Multiple service requests can be executed in a single transaction. When a transaction starts, the session pool picks the least busy connection and puts it in transactional mode. All service requests associated with that transaction are then sent via the selected connection. The connection associated with the transaction is not available for other requests until the transaction either commits or aborts. The transaction should commit or abort before a response is sent to the client, otherwise the connection does not return to the pool of available connections.

A session pool attempts to reestablish failed connections. When a connection fails, in-process transactions and requests fail and return errors. The session pool only reestablishes connections, it does not resubmit failed requests.

Refer to the BEA WebLogic Administrators Guide for information on configuring a session pool.

Author:
  Copyright (c) 1999 by BEA Systems, Inc. All Rights Reserved.
  Copyright © 2001 BEA Systems, Inc. All Rights Reserved.

Constructor Summary
`protected` | `SessionPool(java.lang.String[] addrs, java.lang.String[] saddrs, int minCons, int maxCons, UserInfo usr, boolean keepAlive)` Creates a session pool with multiple connections to the BEA Jolt servers.

Method Summary
`Result` | `call(java.lang.String svcname, DataSet input, Transaction tran)` Invokes a BEA TUXEDO service.
`protected Result` | `call(java.lang.String svcname, java.lang.String[] input, Transaction tran)` Invokes a BEA TUXEDO service.
`Connection` | `getConnection(int index)` This method is part of the session pool administrative API.
`protected bea.jolt.JoltDefinition` | `getDefinition(java.lang.String name)` Gets a service definition.
`int` | `getMaxConnections()` This method is part of the session pool administrative API.
`boolean` | `isSuspended()` This method is part of the session pool administrative API.
`protected void` | `log(java.lang.String msg)` Logs an error message.
`protected DataSet` | `newDataSet(int initCapacity, boolean flag)` A default factory for the `DataSet`.
`protected Result` | `newResult(int initCapacity)` A default factory for the `Result`.
`int` | `setMaxConnections(int maxCons)` This method is part of the session pool administrative API.
`Transaction` | `startTransaction(int timeout)` Starts a transaction.

Methods inherited from class bea.jolt.pool.Factory
`useException`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SessionPool

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

  Creates a session pool with multiple connections to the BEA Jolt servers. Each connection is associated with a server address selected from the primary server address list using a round-robin scheme. The secondary server address list is provided for fail-over. In order to shorten the start-up time, a minimum number of connections can be established at the start-up. The `keepAlive` parameter keeps the session alive by re-establishing any disconnected connection. This constructor is used by the session pool manager.

  Parameters:
    `addrs` - List of server addresses
    `saddrs` - List of secondary server addresses for failover
    `minCons` - Minimum number of connections
    `maxCons` - Maximum number of connections
    `usr` - User authenication info, or null
    `keepalive` - true to keep the session alive

Method Detail

### call

    protected Result call(java.lang.String svcname,
                          java.lang.String[] input,
                          Transaction tran)
                   throws SessionPoolException,
                          ApplicationException,
                          ServiceException,
                          TransactionException

  Invokes a BEA TUXEDO service. The name of the service to be invoked is specified as a parameter to this method. Input parameters to the service are passed as an array of Strings. Each String in the array should be formatted as `name=value`, where `name` is the name of the service parameter and `value` is the value of the parameter. Names that do not match a parameter in the BEA TUXEDO service definition are ignored. To specify multiple occurrences of a name append `_` to `name`. For example, to specify the first and second occurrence of a parameter "ACCOUNT_ID", set `name` to "ACCOUNT_ID_0" and "ACCOUNT_ID_1" respectively. If no input parameters are required for the BEA TUXEDO service, the `input` parameter should `null`.

  To invoke multiple services in a transaction, create a `Transaction` object (see `startTransaction()`) and pass the `Transaction` object as the parameter to this method. If this service is not part of a transaction this parameter should be `null`.

  If the session pool is suspended or if no connections are available, this method throws a SessionPoolException.

  Parameters:
    `svcname` - Name of the BEA TUXEDO service to be invoked
    `input` - String[] of name=value pairs, or null if no input parameters
    `tran` - A Transaction object, or null if no transaction
  Returns:
    A Result object, or null
  See Also:
    `call(java.lang.String, bea.jolt.pool.DataSet, bea.jolt.pool.Transaction)`, `startTransaction(int)`

### call

    public Result call(java.lang.String svcname,
                       DataSet input,
                       Transaction tran)
                throws SessionPoolException,
                       ApplicationException,
                       ServiceException,
                       TransactionException

  Invokes a BEA TUXEDO service. The name of the service to be invoked is passed to this method as a String `svcname`. Input parameters for the service are passed in `input`. If no input parameters are required for the service, `input` should be `null`. The names of the elements in the `input` must match the names of the service parameters.

  To invoke multiple services in a transaction, create a `Transaction` object (see `startTransaction()`) and pass the `Transaction` object as the parameter `tran`. If this service is not part of a transaction `tran` should be `null`.

  If the session pool is suspended or if no connections are available, this method throws a `SessionPoolException`.

  Parameters:
    `svcname` - Name of the service to be invoked
    `input` - DataSet containing service parameters, or null if no input parameters
    `tran` - Transaction object, or null if no transaction
  Returns:
    Result object, or null
  See Also:
    `ServletSessionPool.call(java.lang.String, javax.servlet.http.HttpServletRequest, bea.jolt.pool.Transaction)`, `ServletSessionPool.call(java.lang.String, javax.servlet.http.HttpServletRequest)`, `startTransaction(int)`

### startTransaction

    public Transaction startTransaction(int timeout)
                                 throws SessionPoolException,
                                        TransactionException

  Starts a transaction. The transaction starts on one of the connections in the session pool. Once a transaction starts on a connection, that connection cannot service requests other than those associated with the started transaction. The transaction must end (commit, abort or timeout) before the connection returns to the pool of available connections. The transaction timeout value is specified in seconds.

  Parameters:
    `timeout` - Transaction time-out value in seconds
  Returns:
    Transaction object
  See Also:
    `call(java.lang.String, bea.jolt.pool.DataSet, bea.jolt.pool.Transaction)`, `ServletSessionPool.call(java.lang.String, javax.servlet.http.HttpServletRequest, bea.jolt.pool.Transaction)`

### setMaxConnections

    public int setMaxConnections(int maxCons)

  This method is part of the session pool administrative API. It changes the maximum number of connections for a session pool. The number of connections in a session pool can only be increased using this method; shrinking the session pool is not allowed. This method returns -1 if the caller attempts to shrink the pool size.

  Parameters:
    `maxCons` - New session pool size
  Returns:
    New spool size, or -1 for errors

### getMaxConnections

    public int getMaxConnections()

  This method is part of the session pool administrative API. It returns the maximum number of connections configured in this session pool. The actual number of established connections might be less than the maximum number configured, since connections are created dynamically depending on load.

  Returns:
    Configured maximum number of connections

### isSuspended

    public boolean isSuspended()

  This method is part of the session pool administrative API. It checks if this session pool is suspended. A suspended session pool does not accept any new requests.

  Returns:
    true if the session pool is suspended; otherwise, false
  See Also:
    `SessionPoolManager.suspendSessionPool(java.lang.String, boolean)`

### getConnection

    public Connection getConnection(int index)

  This method is part of the session pool administrative API. It returns the connection at `index` from the session pool. The parameter `index` must be between zero and `maxCons-1` as specified in `bea.jolt.pool.SessionPoolManager.createSessionPool`.

  Parameters:
    `index` - A connection index
  Returns:
    A `Connection` object.

### getDefinition

    protected bea.jolt.JoltDefinition getDefinition(java.lang.String name)

  Gets a service definition.

  Parameters:
    `name` - Service name
  Returns:
    A definition object, or null if not found.

### newDataSet

    protected DataSet newDataSet(int initCapacity,
                                 boolean flag)

  A default factory for the `DataSet`. This method should be overriden by the web-server specific method.

### newResult

    protected Result newResult(int initCapacity)

  A default factory for the `Result`. This method should be overriden by the web-server specific method.

  Overrides:
    newResult in class bea.jolt.pool.Factory

### log

    protected void log(java.lang.String msg)

  Logs an error message. This method should be overridden, so a web-server specific session 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