Changeset 405

Show
Ignore:
Timestamp:
06/11/10 16:39:01 (20 months ago)
Author:
bturner
Message:

start of connection pooling

Location:
branches/ds_pool/src/org/bridgedb/rdb
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • branches/ds_pool/src/org/bridgedb/rdb/SimpleGdb.java

    r318 r405  
    5353public abstract class SimpleGdb extends IDMapperRdb 
    5454{ 
     55     
     56    private JdbcConnectionPool pool; 
     57     
     58     
    5559        private final String connectionString; 
    5660        /** 
     
    6266                this.connectionString = connectionString; 
    6367                this.dbName = dbName; 
     68                 
     69                try 
     70        { 
     71                    // there's something a bit weird that this class does not know 
     72                    // it's underlying driver... 
     73                    String driverClassName = null; 
     74            pool = new JdbcConnectionPool(dbName, driverClassName, connectionString); 
     75        } 
     76        catch (IDMapperException e) 
     77        { 
     78            throw new RuntimeException(e); 
     79        } 
    6480        } 
    6581 
     
    176192        synchronized public Connection getConnection() throws SQLException 
    177193        { 
     194            /* 
    178195                // if singleConnection is true, each call to getConnection() will return the same object. 
    179196                // if singleConnection is false, each call to getConneciton() will lead to a new connection object being created. 
     
    184201                } 
    185202                return con; 
     203                */ 
     204            return pool.getConnection(); 
    186205        } 
    187206         
  • branches/ds_pool/src/org/bridgedb/rdb/SimpleGdbFactory.java

    r326 r405  
    5757                        try  
    5858                        { 
     59                             
    5960                                con = DriverManager.getConnection(connectionString); 
    6061                                stmt = con.createStatement(); 
  • branches/ds_pool/src/org/bridgedb/rdb/SimpleGdbImpl2.java

    r318 r405  
    7373         * A new instance of this class is created automatically. 
    7474         * @param dbName The file containing the Gene Database.  
    75          * @param con An existing SQL Connector. 
     75         * @param data_.con An existing SQL Connector. 
    7676         * @param props PROP_RECREATE if you want to create a new database (possibly overwriting an existing one)  
    7777         *      or PROP_NONE if you want to connect read-only 
  • branches/ds_pool/src/org/bridgedb/rdb/SimpleGdbImpl3.java

    r338 r405  
    3737         * A new instance of this class is created automatically. 
    3838         * @param dbName The file containing the Gene Database.  
    39          * @param con An existing java SQL connection 
     39         * @param data_.con An existing java SQL connection 
    4040         * @param props PROP_RECREATE if you want to create a new database (possibly overwriting an existing one)  
    4141         *      or PROP_NONE if you want to connect read-only