C
- The connection typepublic class PoolingDataSource<C extends java.sql.Connection>
extends java.lang.Object
implements javax.sql.DataSource, java.lang.AutoCloseable
DataSource
implementation that obtains
Connection
s from the specified ObjectPool
.Constructor and Description |
---|
PoolingDataSource(org.apache.commons.pool2.ObjectPool<C> pool) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close and free all
Connection s from the pool. |
java.sql.Connection |
getConnection()
Return a
Connection from my pool,
according to the contract specified by ObjectPool.borrowObject() . |
java.sql.Connection |
getConnection(java.lang.String uname,
java.lang.String passwd)
Throws
UnsupportedOperationException |
int |
getLoginTimeout()
Throws
UnsupportedOperationException . |
java.io.PrintWriter |
getLogWriter()
Returns my log writer.
|
java.util.logging.Logger |
getParentLogger() |
boolean |
isAccessToUnderlyingConnectionAllowed()
Returns the value of the accessToUnderlyingConnectionAllowed property.
|
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
setAccessToUnderlyingConnectionAllowed(boolean allow)
Sets the value of the accessToUnderlyingConnectionAllowed property.
|
void |
setLoginTimeout(int seconds)
Throws
UnsupportedOperationException . |
void |
setLogWriter(java.io.PrintWriter out)
Sets my log writer.
|
<T> T |
unwrap(java.lang.Class<T> iface) |
public PoolingDataSource(org.apache.commons.pool2.ObjectPool<C> pool)
public void close() throws java.lang.Exception
Connection
s from the pool.close
in interface java.lang.AutoCloseable
java.lang.Exception
public java.sql.Connection getConnection() throws java.sql.SQLException
Connection
from my pool,
according to the contract specified by ObjectPool.borrowObject()
.getConnection
in interface javax.sql.DataSource
java.sql.SQLException
public java.sql.Connection getConnection(java.lang.String uname, java.lang.String passwd) throws java.sql.SQLException
UnsupportedOperationException
getConnection
in interface javax.sql.DataSource
java.lang.UnsupportedOperationException
java.sql.SQLException
public int getLoginTimeout()
UnsupportedOperationException
.getLoginTimeout
in interface javax.sql.CommonDataSource
java.lang.UnsupportedOperationException
- As this
implementation does not support this feature.public java.io.PrintWriter getLogWriter()
getLogWriter
in interface javax.sql.CommonDataSource
CommonDataSource.getLogWriter()
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
getParentLogger
in interface javax.sql.CommonDataSource
java.sql.SQLFeatureNotSupportedException
public boolean isAccessToUnderlyingConnectionAllowed()
Connection
is allowed, false otherwise.public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
java.sql.SQLException
public void setAccessToUnderlyingConnectionAllowed(boolean allow)
allow
- Access to the underlying connection is granted when true.public void setLoginTimeout(int seconds)
UnsupportedOperationException
.setLoginTimeout
in interface javax.sql.CommonDataSource
java.lang.UnsupportedOperationException
- As this
implementation does not support this feature.public void setLogWriter(java.io.PrintWriter out)
setLogWriter
in interface javax.sql.CommonDataSource
CommonDataSource.setLogWriter(java.io.PrintWriter)
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
java.sql.SQLException
Copyright © 2001-2015 Apache Software Foundation. Documenation generated July 8 2017.