org.postgresql.ds.PGConnectionPoolDataSource
| Modifier and Type | Class and Description |
|---|---|
| private class | PGPooledConnection.
Instead of declaring a class implementing Connection, which would have to be updated for every JDK rev, use a dynamic proxy to handle all calls through the Connection interface. |
| private class | PGPooledConnection.
Instead of declaring classes implementing Statement, PreparedStatement, and CallableStatement, which would have to be updated for every JDK rev, use a dynamic proxy to handle all calls through the Statement interfaces. |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private @Nullable Connection | |
| private static final String[] | |
| private final boolean | |
| private @Nullable PGPooledConnection. | |
| private final List |
| Access | Constructor and Description |
|---|---|
| public | PGPooledConnection(Connection
connection con, boolean whether to autocommit autoCommit, boolean whether connection is a XA connection isXA)Creates a new PooledConnection representing the specified physical connection. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addConnectionEventListener(ConnectionEventListener
a component, usually the connection pool manager,
that has implemented the
connectionEventListener)ConnectionEventListener interface and wants to be
notified when the connection is closed or has an errorImplements javax. Adds a listener for close or fatal error events on the connection handed out to a client. |
| public void | addStatementEventListener(StatementEventListener
an component which implements the listener)StatementEventListener
interface that is to be registered with this PooledConnection objectImplements javax. Registers a |
| public void | close()
Implements javax. Closes the physical database connection represented by this PooledConnection. |
| protected ConnectionEvent | |
| pack-priv void | |
| private void | fireConnectionError(SQLException
the SQLException to consider e)Fires a connection error event, but only if we think the exception is fatal. |
| pack-priv void | |
| public Connection | getConnection()
Implements javax. Gets a handle for a client to use. |
| private static boolean | |
| public void | removeConnectionEventListener(ConnectionEventListener
a component, usually the connection pool manager,
that has implemented the
connectionEventListener)ConnectionEventListener interface and
been registered with this PooledConnection object as
a listenerImplements javax. Removes a listener for close or fatal error events on the connection handed out to a client. |
| public void | removeStatementEventListener(StatementEventListener
the component which implements the
listener)StatementEventListener interface that was previously
registered with this PooledConnection objectImplements javax. Removes the specified |
| autoCommit | back to summary |
|---|---|
| private final boolean autoCommit | |
| con | back to summary |
|---|---|
| private @Nullable Connection con | |
| fatalClasses | back to summary |
|---|---|
| private static final String[] fatalClasses | |
| isXA | back to summary |
|---|---|
| private final boolean isXA | |
| last | back to summary |
|---|---|
| private @Nullable PGPooledConnection. | |
| listeners | back to summary |
|---|---|
| private final List<ConnectionEventListener> listeners | |
| PGPooledConnection | back to summary |
|---|---|
| public PGPooledConnection(Connection con, boolean autoCommit, boolean isXA) Creates a new PooledConnection representing the specified physical connection.
| |
| PGPooledConnection | back to summary |
|---|---|
| public PGPooledConnection(Connection con, boolean autoCommit) | |
| addConnectionEventListener | back to summary |
|---|---|
| public void addConnectionEventListener(ConnectionEventListener connectionEventListener) Implements javax. Adds a listener for close or fatal error events on the connection handed out to a client.
| |
| addStatementEventListener | back to summary |
|---|---|
| public void addStatementEventListener(StatementEventListener listener) Implements javax. Doc from javax. Registers a
| |
| close | back to summary |
|---|---|
| public void close() throws SQLException Implements javax. Closes the physical database connection represented by this PooledConnection. If any client has a connection based on this PooledConnection, it is forcibly closed as well.
| |
| createConnectionEvent | back to summary |
|---|---|
| protected ConnectionEvent createConnectionEvent(@Nullable SQLException e) | |
| fireConnectionClosed | back to summary |
|---|---|
| pack-priv void fireConnectionClosed() Used to fire a connection closed event to all listeners. | |
| fireConnectionError | back to summary |
|---|---|
| private void fireConnectionError(SQLException e) Fires a connection error event, but only if we think the exception is fatal.
| |
| fireConnectionFatalError | back to summary |
|---|---|
| pack-priv void fireConnectionFatalError(SQLException e) Used to fire a connection error event to all listeners. | |
| getConnection | back to summary |
|---|---|
| public Connection getConnection() throws SQLException Implements javax. 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 physical 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.
| |
| isFatalState | back to summary |
|---|---|
| private static boolean isFatalState(@Nullable String state) | |
| removeConnectionEventListener | back to summary |
|---|---|
| public void removeConnectionEventListener(ConnectionEventListener connectionEventListener) Implements javax. Removes a listener for close or fatal error events on the connection handed out to a client.
| |
| removeStatementEventListener | back to summary |
|---|---|
| public void removeStatementEventListener(StatementEventListener listener) Implements javax. Doc from javax. Removes the specified
| |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private @Nullable Connection | |
| private @Nullable Connection |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| pack-priv Connection | |
| public @Nullable Object | invoke(Object
the proxy instance that the method was invoked on proxy, Method the method, @Nullable Object[] Method instance corresponding to
the interface method invoked on the proxy instance. The declaring
class of the Method object will be the interface that
the method was declared in, which may be a superinterface of the
proxy interface that the proxy class inherits the method through.an array of objects containing the values of the
arguments passed in the method invocation on the proxy instance,
or args)null if interface method takes no arguments.
Arguments of primitive types are wrapped in instances of the
appropriate primitive wrapper class, such as
java.lang.Integer or java.lang.Boolean.Implements java. Processes a method invocation on a proxy instance and returns the result. |
| public boolean | |
| pack-priv void |
| automatic | back to summary |
|---|---|
| private boolean automatic | |
| con | back to summary |
|---|---|
| private @Nullable Connection con | |
| proxy | back to summary |
|---|---|
| private @Nullable Connection proxy | |
| ConnectionHandler | back to summary |
|---|---|
| pack-priv ConnectionHandler(Connection con) | |
| close | back to summary |
|---|---|
| public void close() | |
| getProxy | back to summary |
|---|---|
| pack-priv Connection getProxy() | |
| invoke | back to summary |
|---|---|
| public @Nullable Object invoke(Object proxy, Method method, @Nullable Object[] args) throws Throwable Implements java. Doc from java. Processes a method invocation on a proxy instance and returns the result. This method will be invoked on an invocation handler when a method is invoked on a proxy instance that it is associated with.
| |
| isClosed | back to summary |
|---|---|
| public boolean isClosed() | |
| setProxy | back to summary |
|---|---|
| pack-priv void setProxy(Connection proxy) | |
Instead of declaring classes implementing Statement, PreparedStatement, and CallableStatement, which would have to be updated for every JDK rev, use a dynamic proxy to handle all calls through the Statement interfaces. This is the part that requires JDK 1.3 or higher, though JDK 1.2 could be supported with a 3rd-party proxy package.
The StatementHandler is required in order to return the proper Connection proxy for the getConnection method.
| Modifier and Type | Field and Description |
|---|---|
| private @Nullable PGPooledConnection. | |
| private @Nullable Statement |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public @Nullable Object | invoke(Object
the proxy instance that the method was invoked on proxy, Method the method, @Nullable Object[] Method instance corresponding to
the interface method invoked on the proxy instance. The declaring
class of the Method object will be the interface that
the method was declared in, which may be a superinterface of the
proxy interface that the proxy class inherits the method through.an array of objects containing the values of the
arguments passed in the method invocation on the proxy instance,
or args)null if interface method takes no arguments.
Arguments of primitive types are wrapped in instances of the
appropriate primitive wrapper class, such as
java.lang.Integer or java.lang.Boolean.Implements java. Processes a method invocation on a proxy instance and returns the result. |
| con | back to summary |
|---|---|
| private @Nullable PGPooledConnection. | |
| st | back to summary |
|---|---|
| private @Nullable Statement st | |
| StatementHandler | back to summary |
|---|---|
| pack-priv StatementHandler(PGPooledConnection. | |
| invoke | back to summary |
|---|---|
| public @Nullable Object invoke(Object proxy, Method method, @Nullable Object[] args) throws Throwable Implements java. Doc from java. Processes a method invocation on a proxy instance and returns the result. This method will be invoked on an invocation handler when a method is invoked on a proxy instance that it is associated with.
| |