Package com.impossibl.postgres.jdbc
Class PGPooledConnection
- java.lang.Object
-
- com.impossibl.postgres.jdbc.PGPooledConnection
-
- All Implemented Interfaces:
PooledConnection
- Direct Known Subclasses:
PGXAConnection
public class PGPooledConnection extends Object implements PooledConnection
PooledConnection implementation
-
-
Constructor Summary
Constructors Constructor Description PGPooledConnection(PGDirectConnection con, boolean autoCommit, boolean isXA)Creates a new PooledConnection representing the specified physical connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectionEventListener(ConnectionEventListener connectionEventListener)voidaddStatementEventListener(StatementEventListener statementEventListener)voidclose()Closes the physical database connection represented by this PooledConnection.protected ConnectionEventcreateConnectionEvent(SQLException sqle)protected StatementEventcreateStatementEvent(PreparedStatement ps, SQLException sqle)voidfireConnectionError(SQLException e)Fires a connection error event, but only if we think the exception is fatal.ConnectiongetConnection()protected PGPooledConnectionDelegatorgetConnectionHandle()Gets a handle for a client to use.voidremoveConnectionEventListener(ConnectionEventListener connectionEventListener)voidremoveStatementEventListener(StatementEventListener statementEventListener)
-
-
-
Constructor Detail
-
PGPooledConnection
public PGPooledConnection(PGDirectConnection con, boolean autoCommit, boolean isXA)
Creates a new PooledConnection representing the specified physical connection.
-
-
Method Detail
-
addConnectionEventListener
public void addConnectionEventListener(ConnectionEventListener connectionEventListener)
- Specified by:
addConnectionEventListenerin interfacePooledConnection
-
removeConnectionEventListener
public void removeConnectionEventListener(ConnectionEventListener connectionEventListener)
- Specified by:
removeConnectionEventListenerin interfacePooledConnection
-
addStatementEventListener
public void addStatementEventListener(StatementEventListener statementEventListener)
- Specified by:
addStatementEventListenerin interfacePooledConnection
-
removeStatementEventListener
public void removeStatementEventListener(StatementEventListener statementEventListener)
- Specified by:
removeStatementEventListenerin interfacePooledConnection
-
close
public void close() throws SQLExceptionCloses the physical database connection represented by this PooledConnection. If any client has a connection based on this PooledConnection, it is forcibly closed as well.- Specified by:
closein interfacePooledConnection- Throws:
SQLException
-
getConnectionHandle
protected PGPooledConnectionDelegator getConnectionHandle() throws SQLException
Gets a handle for a client to use. This is a wrapper around the physical connection, so the client can call close and it will just return the connection to the pool without really closing the pgysical connection.According to the JDBC 2.0 Optional Package spec (6.2.3), only one client may have an active handle to the connection at a time, so if there is a previous handle active when this is called, the previous one is forcibly closed and its work rolled back.
- Throws:
SQLException
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnectionin interfacePooledConnection- Throws:
SQLException
-
createConnectionEvent
protected ConnectionEvent createConnectionEvent(SQLException sqle)
-
fireConnectionError
public void fireConnectionError(SQLException e)
Fires a connection error event, but only if we think the exception is fatal.- Parameters:
e- the SQLException to consider
-
createStatementEvent
protected StatementEvent createStatementEvent(PreparedStatement ps, SQLException sqle)
-
-