|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.client.ClientPooledConnection
public class ClientPooledConnection
A physical connection to a data source, to be used for creating logical connections to the same data source.
| Field Summary | |
|---|---|
private int |
eventIterators
The number of iterators going through the list of connection event listeners at the current time. |
private java.util.ArrayList<javax.sql.ConnectionEventListener> |
listeners_
List of ConnectionEventListeners. |
(package private) LogicalConnection |
logicalConnection_
The logical connection using the physical connection. |
protected LogWriter |
logWriter_
|
(package private) NetConnection |
netPhysicalConnection_
|
(package private) NetXAConnection |
netXAPhysicalConnection_
|
private boolean |
newPC_
Tells if this pooled connection is newly created. |
(package private) Connection |
physicalConnection_
|
protected int |
rmId_
Resource manager identificator. |
private JDBCStatementCache |
statementCache
The statement cache for the underlying physical connection. |
| Constructor Summary | |
|---|---|
ClientPooledConnection(ClientBaseDataSourceRoot ds,
LogWriter logWriter,
java.lang.String user,
java.lang.String password)
Constructor for non-XA pooled connections. |
|
ClientPooledConnection(ClientBaseDataSourceRoot ds,
LogWriter logWriter,
java.lang.String user,
java.lang.String password,
int rmId)
Constructor for XA pooled connections only. |
|
| Method Summary | |
|---|---|
void |
addConnectionEventListener(javax.sql.ConnectionEventListener listener)
|
void |
close()
Closes the physical connection to the data source and frees all assoicated resources. |
private void |
createLogicalConnection()
Creates a new logical connection by performing all the required steps to be able to reuse the physical connection. |
protected void |
finalize()
|
private void |
fireConnectionEventListeners(SqlException exception)
Fire all the ConnectionEventListeners registered. |
java.sql.Connection |
getConnection()
Creates a logical connection. |
protected NetXAConnection |
getNetXAConnection(ClientBaseDataSourceRoot ds,
NetLogWriter logWriter,
java.lang.String user,
java.lang.String password,
int rmId)
creates and returns NetXAConnection. |
void |
informListeners(SqlException exception)
Inform listeners that an error has occured on the connection, if the error severity is high enough. |
boolean |
isStatementPoolingEnabled()
Tells is statement pooling is enabled or not. |
void |
nullLogicalConnection()
Used by LogicalConnection.close in some circumstances when
it disassociates itself from the pooled connection. |
void |
onStatementClose(java.sql.PreparedStatement statement)
The onStatementClose contains the logic for raising the Statement Closed events. |
void |
onStatementErrorOccurred(java.sql.PreparedStatement statement,
java.sql.SQLException sqle)
The method contains the logic for raising the Statement error occurred events. |
void |
recycleConnection()
Inform listeners that the logical connection has been closed and that the physical connection is ready for reuse. |
void |
removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.sql.PooledConnection |
|---|
addStatementEventListener, removeStatementEventListener |
| Field Detail |
|---|
private boolean newPC_
private java.util.ArrayList<javax.sql.ConnectionEventListener> listeners_
ConnectionEventListeners. Never null.
private int eventIterators
Connection physicalConnection_
NetConnection netPhysicalConnection_
NetXAConnection netXAPhysicalConnection_
private final JDBCStatementCache statementCache
This will be null if statement caching is disabled (default).
LogicalConnection logicalConnection_
protected LogWriter logWriter_
protected int rmId_
| Constructor Detail |
|---|
public ClientPooledConnection(ClientBaseDataSourceRoot ds,
LogWriter logWriter,
java.lang.String user,
java.lang.String password)
throws java.sql.SQLException
Using standard Java APIs, a CPDS is passed in. Arguments for user/password overrides anything on the data source.
ds - data source creating this pooled connectionlogWriter - destination for log messagesuser - user namepassword - user password
java.sql.SQLException - if creating the pooled connection fails due problems
in the database, or problems communicating with the database
public ClientPooledConnection(ClientBaseDataSourceRoot ds,
LogWriter logWriter,
java.lang.String user,
java.lang.String password,
int rmId)
throws java.sql.SQLException
Using standard Java APIs, a CPDS is passed in. Arguments for user/password overrides anything on the data source.
ds - data source creating this pooled connectionlogWriter - destination for log messagesuser - user namepassword - user passwordrmId - resource manager id
java.sql.SQLException - if creating the pooled connection fails due problems
in the database, or problems communicating with the database| Method Detail |
|---|
public boolean isStatementPoolingEnabled()
true if enabled, false if disabled.
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable
public void close()
throws java.sql.SQLException
close in interface javax.sql.PooledConnectionjava.sql.SQLException - if closing the connection causes an error. Note that
this connection can still be considered closed even if an error
occurs.
public java.sql.Connection getConnection()
throws java.sql.SQLException
This is the standard API for getting a logical connection handle for a pooled connection. No "resettable" properties are passed, so user, password, and all other properties may not change.
getConnection in interface javax.sql.PooledConnectionjava.sql.SQLException - if creating a new logical connection fails
private void createLogicalConnection()
throws SqlException
SqlException - if there is no physical connection, or if any error
occurs when recycling the physical connection or closing/craeting
the logical connectionpublic void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
addConnectionEventListener in interface javax.sql.PooledConnectionpublic void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
removeConnectionEventListener in interface javax.sql.PooledConnectionpublic void recycleConnection()
Not public, but needs to be visible to am.LogicalConnection
public void informListeners(SqlException exception)
Not public, but needs to be visible to am.LogicalConnection
exception - the exception that occurred on the connectionprivate void fireConnectionEventListeners(SqlException exception)
ConnectionEventListeners registered. Callers must
synchronize on this to prevent others from modifying the list of
listeners.
exception - the exception that caused the event, or null if
it is a close eventpublic void nullLogicalConnection()
LogicalConnection.close in some circumstances when
it disassociates itself from the pooled connection.
public void onStatementClose(java.sql.PreparedStatement statement)
statement - The PreparedStatement that was closed
public void onStatementErrorOccurred(java.sql.PreparedStatement statement,
java.sql.SQLException sqle)
statement - The PreparedStatement that was closedsqle - The SQLException associated with the error that caused
the invalidation of this PreparedStatement
protected NetXAConnection getNetXAConnection(ClientBaseDataSourceRoot ds,
NetLogWriter logWriter,
java.lang.String user,
java.lang.String password,
int rmId)
throws SqlException
ds - logWriter - user - password - rmId -
SqlException
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||