Revision 2250
Added by Matt Jones about 20 years ago
src/edu/ucsb/nceas/metacat/DBConnectionPool.java | ||
---|---|---|
108 | 108 |
("Running recycle thread or not: "+DBCONNECTIONRECYCLETHREAD, 49); |
109 | 109 |
MetaCatUtil.debugMessage |
110 | 110 |
("Cycle time of recycle: "+CYCLETIMEOFDBCONNECTION, 49); |
111 |
if (instance == null) |
|
112 |
{ |
|
111 |
if (instance == null) { |
|
113 | 112 |
instance = new DBConnectionPool(); |
114 | 113 |
} |
115 | 114 |
return instance; |
... | ... | |
188 | 187 |
public static synchronized DBConnection getDBConnection(String methodName) |
189 | 188 |
throws SQLException |
190 | 189 |
{ |
190 |
if (instance == null) { |
|
191 |
instance = DBConnectionPool.getInstance(); |
|
192 |
} |
|
191 | 193 |
DBConnection db = null; |
192 | 194 |
int random = 0; //random number |
193 | 195 |
int index = 0; //index |
Also available in: Unified diff
Checked to be sure the instance has been initialized in the getDBCOnnection
static method call. Assuming it has been initialized could (and does)
lead to NullPointerExceptions when used outside of the metacat servlet
if the conneciton pool isn't initialized properly.