|
Oracle Application Server TopLink API Reference 10g Release 2 (10.1.2) B15903-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Purpose: A single session that supports multiple user/clients connection at the same time.
Description: This session supports a shared session that can be used by multiple users or clients in a three-tiered application. It brokers client sessions to allow read and write access through a unified object cache. The server session provides a shared read only database connection that is used by all of its client for reads. All changes to objects and the database must be done through a unit of work acquired from the client session, this allows the changes to occur in a transactional object space and under a exclusive database connection.
Responsibilities:
ClientSession
, UnitOfWork
Method Summary | |
ClientSession |
acquireClientSession() PUBLIC: Return a client session for this server session. |
ClientSession |
acquireClientSession(ConnectionPolicy connectionPolicy) PUBLIC: Return a client session for this server session. |
ClientSession |
acquireClientSession(DatabaseLogin login) PUBLIC: Return a client session for this server session. |
ClientSession |
acquireClientSession(java.lang.String poolName) PUBLIC: Return a client session for this server session. |
void |
addConnectionPool(ConnectionPool pool) PUBLIC: Connection are pooled to share and restrict the number of database connections. |
void |
addConnectionPool(java.lang.String poolName, DatabaseLogin login, int minNumberOfConnections, int maxNumberOfConnections) PUBLIC: Add the connection pool. |
ConnectionPool |
getConnectionPool(java.lang.String poolName) PUBLIC: Return the pool by name. |
ConnectionPolicy |
getDefaultConnectionPolicy() PUBLIC: The default connection policy is used by default by the acquireClientConnection() protocol. |
ConnectionPool |
getDefaultConnectionPool() PUBLIC: Return the default connection pool. |
int |
getMaxNumberOfNonPooledConnections() PUBLIC: Return the number of non-pooled database connections allowed. |
int |
getNumberOfReadConnections() Deprecated. |
ConnectionPool |
getReadConnectionPool() PUBLIC: Handles allocating connections for read queries. |
void |
setDefaultConnectionPolicy(ConnectionPolicy defaultConnectionPolicy) PUBLIC: The default connection policy is used by default by the acquireClientConnection() protocol. |
void |
setMaxNumberOfNonPooledConnections(int maxNumberOfNonPooledConnections) PUBLIC: Set the number of non-pooled database connections allowed. |
void |
setNumberOfReadConnections(int numberOfReadConnections) Deprecated. |
void |
setReadConnectionPool(ConnectionPool readConnectionPool) PUBLIC: Sets the read connection pool directly. |
void |
useExclusiveReadConnectionPool(int minNumberOfConnections, int maxNumberOfConnections) PUBLIC: Sets the read connection pool to be a standard ConnectionPool . |
void |
useExternalReadConnectionPool() PUBLIC: Sets the read connection pool to be an ExternalConnectionPool . |
void |
useReadConnectionPool(int minNumberOfConnections, int maxNumberOfConnections) PUBLIC: Sets the read connection pool to be a ReadConnectionPool . |
Methods inherited from interface oracle.toplink.sessions.DatabaseSession |
addDescriptor, addDescriptors, addDescriptors, beginTransaction, commitTransaction, deleteAllObjects, deleteAllObjects, deleteObject, insertObject, isInTransaction, login, login, login, logout, refreshAndLockObject, refreshAndLockObject, rollbackTransaction, setExternalTransactionController, setLogin, updateObject, writeAllObjects, writeAllObjects, writeObject |
Method Detail |
public ClientSession acquireClientSession() throws DatabaseException
DatabaseException
public ClientSession acquireClientSession(java.lang.String poolName)
public ClientSession acquireClientSession(DatabaseLogin login)
public ClientSession acquireClientSession(ConnectionPolicy connectionPolicy)
public void addConnectionPool(java.lang.String poolName, DatabaseLogin login, int minNumberOfConnections, int maxNumberOfConnections)
public void addConnectionPool(ConnectionPool pool)
public ConnectionPool getConnectionPool(java.lang.String poolName)
public ConnectionPolicy getDefaultConnectionPolicy()
public ConnectionPool getDefaultConnectionPool()
public int getMaxNumberOfNonPooledConnections()
public int getNumberOfReadConnections()
public ConnectionPool getReadConnectionPool()
By default a read connection pool is created and configured automatically in the constructor. A default read connection pool is one with two connections, and does not support concurrent reads.
The read connection pool is not used while in transaction.
setReadConnectionPool(ConnectionPool)
, useExclusiveReadConnectionPool(int, int)
, useExternalReadConnectionPool()
, useReadConnectionPool(int, int)
public void setDefaultConnectionPolicy(ConnectionPolicy defaultConnectionPolicy)
public void setMaxNumberOfNonPooledConnections(int maxNumberOfNonPooledConnections)
public void setNumberOfReadConnections(int numberOfReadConnections)
public void setReadConnectionPool(ConnectionPool readConnectionPool)
Either useExclusiveReadConnectionPool(int, int)
or useExternalReadConnectionPool()
is called in the constructor. For a connection pool using concurrent reading useReadConnectionPool(int, int)
should be called on a new instance of this
.
ValidationException
- if already connectedpublic void useExclusiveReadConnectionPool(int minNumberOfConnections, int maxNumberOfConnections)
ConnectionPool
.
Minimum and maximum number of connections is determined from the ConnectionPolicy. The defaults are 2 for both.
Since the same type of connection pool is used as for writing, no two users will use the same connection for reading at the same time.
This read connection pool is the default as some JDBC drivers do not support concurrent reading.
Unless this
hasExternalTransactionController()
a read connection pool of this type will be setup in the constructor.
getReadConnectionPool()
, setReadConnectionPool(ConnectionPool)
, useReadConnectionPool(int, int)
, useExternalReadConnectionPool()
public void useExternalReadConnectionPool()
ExternalConnectionPool
.
This type of connection pool will be created and configured automatically if an external transaction controller is used.
Session.hasExternalTransactionController()
, getReadConnectionPool()
, setReadConnectionPool(ConnectionPool)
, useReadConnectionPool(int, int)
, useExclusiveReadConnectionPool(int, int)
public void useReadConnectionPool(int minNumberOfConnections, int maxNumberOfConnections)
ReadConnectionPool
.
Since read connections are not used for writing, multiple users can theoretically use the same connection at the same time. Most JDBC drivers have concurrent reading which supports this.
Use this read connection pool to take advantage of concurrent reading.
minNumberOfConnections
-maxNumberOfConnections
- As multiple readers can use the same connection concurrently fewer connections are needed.getReadConnectionPool()
, setReadConnectionPool(ConnectionPool)
, useExternalReadConnectionPool()
, useExclusiveReadConnectionPool(int, int)
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |