搜索
您的当前位置:首页正文

289@paramtimeout以毫秒计的等待时间限制

来源:好走旅游网
289 * @param timeout 以毫秒计的等待时间限制 290 */

291 public synchronized Connection getConnection(long timeout) {

292 long startTime = new Date().getTime();

293 Connection con;

294 while ((con = getConnection()) == null) { 295 try {

296 wait(timeout); 297 }

298 catch (InterruptedException e) {}

299 if ((new Date().getTime() - startTime) >= timeout) {

300 // wait()返回的原因是超时

301 return null; 302 } 303 }

304 return con; 305 } 306 307 /**

308 * 关闭所有连接 309 */

310 public synchronized void release() {

311 Enumeration allConnections = freeConnections.elements();

因篇幅问题不能全部显示,请点此查看更多更全内容

Top