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.

Method Summary
 Result call(java.lang.String svcname, DataSet input, Transaction tran)
          Invokes a BEA Tuxedo service.
 java.lang.String[] getAppAddr()
           
 Connection getConnection(int index)
          This method is part of the session pool administrative API.
 java.lang.String[] getFailOverAddr()
           
 int getMaxConnections()
          This method is part of the session pool administrative API.
 int getMinConn()
           
 java.lang.String getPoolName()
           
 SecurityContext getSecurityContextClass()
           
 UserInfo getUser()
           
 boolean isKeepAlive()
          Check if it is a keep alive session.
 boolean isSuspended()
          This method is part of the session pool administrative API.
 boolean propagateSecurityContext()
           
 void setKeepAlive(boolean keepAlive)
           
 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 java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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
Throws:
SessionPoolException - No connections are available.
ApplicationException - An application error occurred.
ServiceException - A system error occurred.
TransactionException - A transaction error occurred.
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
Throws:
SessionPoolException - No connections are available.
TransactionException - A transaction error occurred.
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.

getPoolName

public java.lang.String getPoolName()

getAppAddr

public java.lang.String[] getAppAddr()

getFailOverAddr

public java.lang.String[] getFailOverAddr()

getMinConn

public int getMinConn()

getUser

public UserInfo getUser()

propagateSecurityContext

public boolean propagateSecurityContext()

getSecurityContextClass

public SecurityContext getSecurityContextClass()

isKeepAlive

public boolean isKeepAlive()
Check if it is a keep alive session.


setKeepAlive

public void setKeepAlive(boolean keepAlive)