Mongo java 程序中 空指针
public synchronized DBCollection getDBCollection(String collection_name){DBCollection dbColl = null;
System.out.println("poolSize:"+dbPool.size());
while(dbPool.size() == 0){
try {
System.out.println("sleep------------------------------------");
java.lang.Thread.sleep(100);
} catch (InterruptedException e) {
System.out.println("连接全部用光,这里sleep出错了.");
}
}
System.out.println(collection_name+"-----------");
//NullPointException
dbColl = dbPool.remove(0).getCollection(collection_name);
return dbColl;
}