ReadConnectionPoolpublic class ReadConnectionPool extends ConnectionPool
Purpose:The read connection pool is used for read access through the server session.
Any of the connection pools can be used for the read pool however this is the default.
This pool allows for concurrent reads against the same JDBC connection and requires that
the JDBC connection support concurrent read access. |
Constructors Summary |
---|
public ReadConnectionPool()PUBLIC:
Build a new read connection pool.
super();
| public ReadConnectionPool(String name, Login login, int minNumberOfConnections, int maxNumberOfConnections, ServerSession owner)PUBLIC:
Build a new read connection pool.
super(name, login, minNumberOfConnections, maxNumberOfConnections, owner);
|
Methods Summary |
---|
public synchronized oracle.toplink.essentials.internal.databaseaccess.Accessor | acquireConnection()INTERNAL:
Wait until a connection is avaiable and allocate the connection for the client.
Accessor leastBusyConnection = null;
// Search for an unused connection, also find the least busy incase all are used.
for (Enumeration connectionsEnum = getConnectionsAvailable().elements();
connectionsEnum.hasMoreElements();) {
Accessor connection = (Accessor)connectionsEnum.nextElement();
if (connection.getCallCount() == 0) {
connection.incrementCallCount(getOwner());
return connection;
}
if ((leastBusyConnection == null) || (leastBusyConnection.getCallCount() > connection.getCallCount())) {
leastBusyConnection = connection;
}
}
// If still not at max, add a new connection.
if (getTotalNumberOfConnections() < getMaxNumberOfConnections()) {
Accessor connection = buildConnection();
getConnectionsAvailable().addElement(connection);
connection.incrementCallCount(getOwner());
return connection;
}
// Use the least busy connection.
leastBusyConnection.incrementCallCount(getOwner());
return leastBusyConnection;
| public boolean | hasConnectionAvailable()INTERNAL:
Concurrent reads are supported.
return true;
| public synchronized void | releaseConnection(oracle.toplink.essentials.internal.databaseaccess.Accessor connection)INTERNAL:
Because connections are not exclusive nothing is required.
connection.decrementCallCount();
|
|