getInstance()应该要处理同步问题:public synchronized static ConnectinoPool getInstance(){
if(mySelf==null){
synchronized(this){
if(mySelf==null){
mySelf = new ConnectionPool();
}
}
}
return mySelf;
}
或者:private static ConnectionPool mySelf = new ConnectionPool();public synchronized static ConnectinoPool getInstance(){
return mySelf;
}
if(mySelf==null){
synchronized(this){
if(mySelf==null){
mySelf = new ConnectionPool();
}
}
}
return mySelf;
}
或者:private static ConnectionPool mySelf = new ConnectionPool();public synchronized static ConnectinoPool getInstance(){
return mySelf;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货