org.mentawai.db
Class BoneCPConnectionHandler

java.lang.Object
  extended by org.mentawai.db.AbstractConnectionHandler
      extended by org.mentawai.db.BoneCPConnectionHandler
All Implemented Interfaces:
org.mentacontainer.Factory, org.mentacontainer.Interceptor<Connection>, ConnectionHandler
Direct Known Subclasses:
MySQLBoneCPConnectionHandler

public class BoneCPConnectionHandler
extends AbstractConnectionHandler


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.mentawai.db.ConnectionHandler
ConnectionHandler.Exec
 
Constructor Summary
BoneCPConnectionHandler(String driver, com.jolbox.bonecp.BoneCPConfig config)
           
BoneCPConnectionHandler(String driver, String url, String user, String pass)
           
BoneCPConnectionHandler(String driver, String url, String user, String pass, String testQuery)
           
 
Method Summary
 void destroy()
          Destroy the connection pool, closing and cleaning all connections.
 com.jolbox.bonecp.BoneCP getBoneCP()
           
 Connection getConnection()
          Returns a Connection to the database.
 com.jolbox.bonecp.Statistics getStatistics()
           
 String getStatus()
          Print the status of this connection pool if any.
 void release(Connection conn)
          Release this connection.
 
Methods inherited from class org.mentawai.db.AbstractConnectionHandler
exec, getInstance, getType, onCleared, onCreated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoneCPConnectionHandler

public BoneCPConnectionHandler(String driver,
                               String url,
                               String user,
                               String pass,
                               String testQuery)

BoneCPConnectionHandler

public BoneCPConnectionHandler(String driver,
                               String url,
                               String user,
                               String pass)

BoneCPConnectionHandler

public BoneCPConnectionHandler(String driver,
                               com.jolbox.bonecp.BoneCPConfig config)
Method Detail

getBoneCP

public com.jolbox.bonecp.BoneCP getBoneCP()

getStatistics

public com.jolbox.bonecp.Statistics getStatistics()

getConnection

public Connection getConnection()
                         throws SQLException
Description copied from interface: ConnectionHandler
Returns a Connection to the database. Notice that it can never return null. If no connection can be acquired, then a SQLException is thrown.

Returns:
A connection to the database.
Throws:
SQLException - if there were problems trying to acquire the connection.

release

public void release(Connection conn)
Description copied from interface: ConnectionHandler
Release this connection. If this connection handler is using a database pool, the connection is returned to the pool. If this connection handler is not using a database pool, the connection is closed. If the connection passed as an argument is null, nothing is done.

Parameters:
conn - The connection to release.

destroy

public void destroy()
Description copied from interface: ConnectionHandler
Destroy the connection pool, closing and cleaning all connections. This is important for restarting the web context.


getStatus

public String getStatus()
Description copied from interface: ConnectionHandler
Print the status of this connection pool if any.

Returns:
The status


Copyright © 2013. All Rights Reserved.