Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.firebirdsql.pool.AbstractConnectionPool
org.firebirdsql.pool.BasicAbstractConnectionPool
org.firebirdsql.pool.AbstractDriverConnectionPoolDataSource
public abstract class AbstractDriverConnectionPoolDataSource
extends BasicAbstractConnectionPool
implements ConnectionPoolDataSource, PooledConnectionEventListener
javax.sql.ConnectionPoolDataSource
that
uses java.sql.DriverManager
to open physical connections to the
database.
Nested Class Summary |
Nested classes/interfaces inherited from class org.firebirdsql.pool.AbstractConnectionPool | |
AbstractConnectionPool.UserPasswordPair |
Field Summary | |
protected static String | |
static AbstractConnectionPool.UserPasswordPair | |
protected static String | |
protected static String |
Constructor Summary | |
|
Method Summary | |
void |
|
void |
|
protected BasicAbstractConnectionPool |
|
protected PooledConnectionManager |
|
Reference |
|
String | |
int |
|
String | |
String | |
PrintWriter | |
protected org.firebirdsql.logging.Logger |
|
int |
|
protected String |
|
PooledConnection |
|
PooledConnection |
|
protected PooledObject |
|
Properties | |
String |
|
int |
|
int | |
int |
|
void |
|
void |
|
protected Object |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class org.firebirdsql.pool.AbstractConnectionPool | |
finalize , getConfiguration , getConnectionManager , getFreeSize , getLogger , getPoolName , getPooledConnection , getQueue , getTotalSize , getWorkingSize , physicalConnectionDeallocated , pooledObjectReleased , restart , shutdown |
protected static final String DRIVER_CLASS_NAME
protected static final String JDBC_URL
protected static final String PROPERTIES
public AbstractDriverConnectionPoolDataSource()
Create instance of this class.
public void connectionClosed(ConnectionEvent connectionEvent)
Notify about connection being closed.
- Parameters:
connectionEvent
- instance ofConnectionEvent
.
public void connectionErrorOccurred(ConnectionEvent event)
Notify about serious error when using the connection. Currently these events are ignored.
- Parameters:
event
- instance ofConnectionEvent
containing information about an error.
protected BasicAbstractConnectionPool createObjectInstance()
Create instance of this data source.
- Overrides:
- createObjectInstance in interface BasicAbstractConnectionPool
protected PooledConnectionManager getConnectionManager() throws SQLException
Get connection manager that will allocate physical connections to the database.
- Overrides:
- getConnectionManager in interface AbstractConnectionPool
- Returns:
- instance of
PooledConnectionManager
class.
public Reference getDefaultReference()
Get default JNDI reference for this instance.
- Overrides:
- getDefaultReference in interface BasicAbstractConnectionPool
public String getDriverClassName()
public int getFreeSize() throws SQLException
Get number of free connections in this pool. This method returns the number of free open connections to the specified database. It might return 0, but this does not mean that next request will block. This will happen only ifgetMaxSize() != 0 && getMaxSize() == getWorkingSize()
, meaning that we have allocated maximum number of connections and all of them are in use.
- Overrides:
- getFreeSize in interface AbstractConnectionPool
- Returns:
- number of free connections left.
public String getIsolation()
public String getJdbcUrl()
public PrintWriter getLogWriter()
- Overrides:
- getLogWriter in interface BasicAbstractConnectionPool
protected org.firebirdsql.logging.Logger getLogger()
Get logger for this instance. By default all log messages belong to this class. Subclasses can override this behavior.
- Overrides:
- getLogger in interface AbstractConnectionPool
- Returns:
- instance of
Logger
.
public int getLoginTimeout()
Get login timeout.
- Overrides:
- getLoginTimeout in interface BasicAbstractConnectionPool
- Returns:
- value set in
setLoginTimeout(int)
method or 0.
protected String getPoolName()
Get name of this connection pool.
- Overrides:
- getPoolName in interface AbstractConnectionPool
- Returns:
- name of the pool, equal to the JDBC URL value.
public PooledConnection getPooledConnection() throws SQLException
Get pooled connection. This method will block until there will be free connection to return.
- Overrides:
- getPooledConnection in interface BasicAbstractConnectionPool
- Returns:
- instance of
PooledConnection
.
public PooledConnection getPooledConnection(String user, String password) throws SQLException
Get pooled connection for the specified user name and password.
- Overrides:
- getPooledConnection in interface BasicAbstractConnectionPool
- Parameters:
user
- user name.password
- password corresponding to specified user name.
- Returns:
- instance of
PooledConnection
for the specified credentials.
protected PooledObject getPooledConnection(org.firebirdsql.pool.PooledConnectionQueue queue) throws SQLException
Get pooled connection from the pooled queue.
- Overrides:
- getPooledConnection in interface AbstractConnectionPool
public Properties getProperties()
public String getProperty(String name)
public int getTotalSize() throws SQLException
Get total size of physical connections opened to the database.
- Overrides:
- getTotalSize in interface AbstractConnectionPool
- Returns:
- total number of opened connections to the database.
public int getTransactionIsolationLevel()
public int getWorkingSize() throws SQLException
Get number of connections that are in use.
- Overrides:
- getWorkingSize in interface AbstractConnectionPool
- Returns:
- number of working connections.
public void physicalConnectionClosed(ConnectionEvent connectionEvent)
Notify about physical connection being closed.
- Specified by:
- physicalConnectionClosed in interface PooledConnectionEventListener
- Parameters:
connectionEvent
- instance ofConnectionEvent
.
public void physicalConnectionDeallocated(ConnectionEvent connectionEvent)
Notify about the deallocation of the physical connection.
- Specified by:
- physicalConnectionDeallocated in interface PooledConnectionEventListener
- Parameters:
connectionEvent
- instance ofConnectionEvent
.
protected Object processObjectInstance(AbstractDriverConnectionPoolDataSource ds, Object obj) throws Exception
public void setDriverClassName(String driverClassName)
public void setIsolation(String isolation) throws SQLException
public void setJdbcUrl(String jdbcUrl)
public void setLogWriter(PrintWriter out)
- Overrides:
- setLogWriter in interface BasicAbstractConnectionPool
public void setLoginTimeout(int seconds)
Set login timeout for new connection. Currently ignored.
- Overrides:
- setLoginTimeout in interface BasicAbstractConnectionPool
- Parameters:
seconds
- how long pool should wait until new connection is granted.
public void setProperties(Properties properties)
Set JDBC properties that will be passed when opening a connection.
- Parameters:
properties
- instance ofProperties
containing properties of a connection to open.
- See Also:
getProperties()
public void setProperty(String name, String value)
public void setTransactionIsolationLevel(int transactionIsolation)