public static void docWrite(List<DBObject> docs) throws UnknownHostException { if (docs.size() > 0) { if (_docCount.getAndAdd(docs.size()) == 0) { String[] params = _targetns.split("\\."); DB db = new MongoClient(_tgtURI).getDB(params[0]); _tgt = db.getCollection(params[1]); db.requestEnsureConnection(); db.requestStart(); } _tgt.insert(docs.toArray(new DBObject[0])); } }
private DB getDatabase() { db.requestEnsureConnection(); return db; }