Revision 1558
Added by Jing Tao over 21 years ago
src/edu/ucsb/nceas/metacat/DBConnectionPool.java | ||
---|---|---|
191 | 191 |
int random = 0; //random number |
192 | 192 |
int index = 0; //index |
193 | 193 |
int size = 0; //size of connection pool |
194 |
MetaCatUtil.debugMessage("Try to checking out connection...", 45);
|
|
194 |
MetaCatUtil.debugMessage("Try to checking out connection...", 55);
|
|
195 | 195 |
size = connectionPool.size(); |
196 | 196 |
MetaCatUtil.debugMessage("size of connection pool: "+size, 45); |
197 | 197 |
|
... | ... | |
206 | 206 |
{ |
207 | 207 |
index =(i+random)%size; |
208 | 208 |
db = (DBConnection) connectionPool.elementAt(index); |
209 |
MetaCatUtil.debugMessage("Index: "+index, 45);
|
|
210 |
MetaCatUtil.debugMessage("Tag: "+db.getTag(), 45);
|
|
211 |
MetaCatUtil.debugMessage("Status: "+db.getStatus(), 45);
|
|
209 |
MetaCatUtil.debugMessage("Index: "+index, 55);
|
|
210 |
MetaCatUtil.debugMessage("Tag: "+db.getTag(), 55);
|
|
211 |
MetaCatUtil.debugMessage("Status: "+db.getStatus(), 55);
|
|
212 | 212 |
//check if the connection is free |
213 | 213 |
if (db.getStatus()==FREE) |
214 | 214 |
{ |
... | ... | |
227 | 227 |
db.setAutoCommit(true); |
228 | 228 |
//debug message |
229 | 229 |
MetaCatUtil.debugMessage("The connection is checked out: " |
230 |
+db.getTag(), 35);
|
|
230 |
+db.getTag(), 55);
|
|
231 | 231 |
MetaCatUtil.debugMessage("The method for checking is: " |
232 |
+db.getCheckOutMethodName(), 35);
|
|
233 |
MetaCatUtil.debugMessage("The age is "+db.getAge(), 40);
|
|
234 |
MetaCatUtil.debugMessage("The usage is "+db.getUsageCount(), 40);
|
|
232 |
+db.getCheckOutMethodName(), 45);
|
|
233 |
MetaCatUtil.debugMessage("The age is "+db.getAge(), 55);
|
|
234 |
MetaCatUtil.debugMessage("The usage is "+db.getUsageCount(), 55);
|
|
235 | 235 |
MetaCatUtil.debugMessage("The conection time it has: " |
236 |
+db.getConnectionTime(), 40);
|
|
236 |
+db.getConnectionTime(), 55);
|
|
237 | 237 |
//set check out time |
238 | 238 |
db.setCheckOutTime(System.currentTimeMillis()); |
239 | 239 |
//check it out |
... | ... | |
397 | 397 |
//if it is same return it. If it is not same, maybe the connection already |
398 | 398 |
// was returned ealier. |
399 | 399 |
MetaCatUtil.debugMessage("serial number in Connection: " |
400 |
+conn.getCheckOutSerialNumber(), 40);
|
|
401 |
MetaCatUtil.debugMessage("serial number in local: "+serialNumber, 40);
|
|
400 |
+conn.getCheckOutSerialNumber(), 55);
|
|
401 |
MetaCatUtil.debugMessage("serial number in local: "+serialNumber, 55);
|
|
402 | 402 |
if (conn.getCheckOutSerialNumber() == serialNumber) |
403 | 403 |
{ |
404 | 404 |
dbConn = (DBConnection) connectionPool.elementAt(index); |
... | ... | |
412 | 412 |
dbConn.setCheckOutTime(0); |
413 | 413 |
|
414 | 414 |
MetaCatUtil.debugMessage("Connection: "+dbConn.getTag()+" checked in.", |
415 |
35);
|
|
416 |
MetaCatUtil.debugMessage("Connection: "+dbConn.getTag()+"'s status: "
|
|
417 |
+dbConn.getStatus(), 35);
|
|
415 |
55);
|
|
416 |
MetaCatUtil.debugMessage("Connection: "+dbConn.getTag()+"'s status: " |
|
417 |
+dbConn.getStatus(), 55);
|
|
418 | 418 |
|
419 | 419 |
}//if |
420 | 420 |
else |
Also available in: Unified diff
Change some debug level