C - The connection typepublic class PoolingDataSource<C extends java.sql.Connection>
extends java.lang.Object
implements javax.sql.DataSource, java.lang.AutoCloseable
| Constructor and Description |
|---|
PoolingDataSource(ObjectPool<C> pool)
Constructs a new instance backed by the given connection pool.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes and free all
Connections from the pool. |
java.sql.Connection |
getConnection()
Returns 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() |
protected ObjectPool<C> |
getPool() |
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(ObjectPool<C> pool)
pool - the given connection pool.public void close()
throws java.lang.RuntimeException,
java.sql.SQLException
Connections from the pool.close in interface java.lang.AutoCloseablejava.lang.RuntimeExceptionjava.sql.SQLExceptionpublic boolean isAccessToUnderlyingConnectionAllowed()
Connection is allowed, false otherwise.public void setAccessToUnderlyingConnectionAllowed(boolean allow)
allow - Access to the underlying connection is granted when true.public boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperjava.sql.SQLExceptionpublic <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap in interface java.sql.Wrapperjava.sql.SQLExceptionpublic java.util.logging.Logger getParentLogger()
throws java.sql.SQLFeatureNotSupportedException
getParentLogger in interface javax.sql.CommonDataSourcejava.sql.SQLFeatureNotSupportedExceptionpublic 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.DataSourcejava.sql.SQLExceptionpublic java.sql.Connection getConnection(java.lang.String uname,
java.lang.String passwd)
throws java.sql.SQLException
UnsupportedOperationExceptiongetConnection in interface javax.sql.DataSourcejava.lang.UnsupportedOperationException - always thrownjava.sql.SQLExceptionpublic java.io.PrintWriter getLogWriter()
getLogWriter in interface javax.sql.CommonDataSourceCommonDataSource.getLogWriter()public int getLoginTimeout()
UnsupportedOperationException.getLoginTimeout in interface javax.sql.CommonDataSourcejava.lang.UnsupportedOperationException - As this implementation does not support this feature.public void setLoginTimeout(int seconds)
UnsupportedOperationException.setLoginTimeout in interface javax.sql.CommonDataSourcejava.lang.UnsupportedOperationException - As this implementation does not support this feature.public void setLogWriter(java.io.PrintWriter out)
setLogWriter in interface javax.sql.CommonDataSourceCommonDataSource.setLogWriter(java.io.PrintWriter)protected ObjectPool<C> getPool()
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.