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

start of connection pooling

Files:
1 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