Show
Ignore:
Timestamp:
02/25/10 20:57:43 (2 years ago)
Author:
martijn
Message:

Made SimpleGdb? thread-safe. Instantiate with con-
nection string instead of connection object, to allow
future implementation of thread pooling

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/org.bridgedb.rdb/src/org/bridgedb/rdb/IDMapperRdb.java

    r317 r318  
    5656                public IDMapper connect(String location) throws IDMapperException  
    5757                { 
    58                         try 
    59                         { 
    60                                 String url = "jdbc:derby:jar:(" + location + ")database"; 
    61                                 Connection con = DriverManager.getConnection(url); 
    62                                 return SimpleGdbFactory.createInstance(location, con); 
    63                         } 
    64                         catch (SQLException ex) 
    65                         { 
    66                                 throw new IDMapperException(ex); 
    67                         } 
     58                        String url = "jdbc:derby:jar:(" + location + ")database"; 
     59                        return SimpleGdbFactory.createInstance(location, url); 
    6860                } 
    6961        } 
     
    7769                public IDMapper connect(String location) throws IDMapperException  
    7870                { 
    79                         try 
    80                         { 
    81                                 String url = "jdbc:" + location; 
    82                                 Connection con = DriverManager.getConnection(url); 
    83                                 return SimpleGdbFactory.createInstance(location, con); 
    84                         } 
    85                         catch (SQLException ex) 
    86                         { 
    87                                 throw new IDMapperException(ex); 
    88                         } 
     71                        String url = "jdbc:" + location; 
     72                        return SimpleGdbFactory.createInstance(location, url); 
    8973                } 
    9074        } 
     
    11599                                 
    116100                                String url = "jdbc:derby://" + host + ":" + port + "/" + args.get("BASE"); 
    117                                 Connection con = DriverManager.getConnection(url); 
    118                                 return SimpleGdbFactory.createInstance(location, con); 
    119                         } 
    120                         catch (SQLException f) 
    121                         { 
    122                                 throw new IDMapperException (f); 
     101                                return SimpleGdbFactory.createInstance(location, url); 
    123102                        } 
    124103                        catch (IOException e)