标题:Mongo java 程序中 空指针
取消只看楼主
fengmnll
Rank: 1
等 级:新手上路
帖 子:79
专家分:3
注 册:2008-11-6
结帖率:85.71%
 问题点数:0 回复次数:0 
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;
    }
搜索更多相关主题的帖子: java public sleep while 
2011-10-09 14:35



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-351887-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023339 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved