断开连接时的线程安全问题
try{
conn=ds.getConnection();
stmt=conn.createstatement();
rs=stmt.executeQuery("");
......
rs.close();//-----------------1
rs=null;
stmt.close();
stmt=null;
conn.close();
conn=null;//------------------1
}
catch(Exception e){
....}
finally{//--------------------2
if(rs!=null){
try{
rs.close();}
catch(Exception e){...}
rs=null;
}
if(stmt!=null){
try{
stmt.close();}
catch(Exception e){...}
stmt=null;
}
if(conn!=null){
try{
conn.close();}
catch(Exception e){...}
conn=null;
}---------------------------2
}