|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.p6spy.engine.spy.P6PooledConnection
This class is used to manage pooled connections. Instances are created by the P6ConnectionPoolDataSource factory class, and have a physical Connection. Instances of this class are usable for as long as the physical connections is open. Calls to getConnection on this class produce instances of the P6ProxyConnection class.
PooledConnection
,
ConnectionPoolDataSource
,
P6ConnectionPoolDataSource
,
P6ProxyConnection
Field Summary | |
static int |
EVENT_TYPE_CLOSE
|
static int |
EVENT_TYPE_ERROR
|
protected Connection |
proxyConnection
|
protected Connection |
realConnection
|
Constructor Summary | |
P6PooledConnection(Connection connection)
P6ConnectionPoolDataSource creates a realConnection (a P6 wrapper for the realDriver Connection) and then constructs this to contain it. |
Method Summary | |
void |
addConnectionEventListener(ConnectionEventListener eventTarget)
Registers submitted ConnectionEventListener as a target for delivery of events of the ConnectionEvents type, either close or error events. |
void |
close()
Connection Pool managers such as EJB containers call this when they want to close the real connections, as during shutdown or reconfiguration, or when this instance has delivered a connectionErrorOccured event. |
protected void |
deliverEvent(int type,
SQLException sqlException)
Creates and delivers a ConnectionEvent to all registered (as registered in addConnectionEventListener) event targets. |
Connection |
getConnection()
Creates a new P6ProxyConnection, associates it with the real connection, and returns it. |
void |
removeConnectionEventListener(ConnectionEventListener eventTarget)
Removes ConnectionEventListeners from the list of targets for event delivery. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Connection proxyConnection
protected Connection realConnection
public static final int EVENT_TYPE_CLOSE
public static final int EVENT_TYPE_ERROR
Constructor Detail |
public P6PooledConnection(Connection connection)
connection
- the "real" or "physical" connection, i.e. the type of
object that would result from a call to P6SpyDriver.connect()Method Detail |
public Connection getConnection() throws SQLException
getConnection
in interface PooledConnection
SQLException
public void close() throws SQLException
close
in interface PooledConnection
SQLException
- from underlying real connection closepublic void addConnectionEventListener(ConnectionEventListener eventTarget)
addConnectionEventListener
in interface PooledConnection
eventTarget
- listener to be notified with ConnectionEventspublic void removeConnectionEventListener(ConnectionEventListener eventTarget)
removeConnectionEventListener
in interface PooledConnection
eventTarget
- listener to be removedprotected void deliverEvent(int type, SQLException sqlException)
type
- indicating connectionClosed (P6PooledConnection.EVENT_TYPE_CLOSE)
or connectionErrorOccurred (P6PooledConnection.EVENT_TYPE_ERROR)
SQLException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |