com.mongodb
Class Mongo.Holder

java.lang.Object
  extended by com.mongodb.Mongo.Holder
Enclosing class:
Mongo

public static class Mongo.Holder
extends Object

Mongo.Holder can be used as a static place to hold several instances of Mongo. Security is not enforced at this level, and needs to be done on the application side.


Constructor Summary
Mongo.Holder()
           
 
Method Summary
 Mongo connect(MongoURI uri)
          Attempts to find an existing Mongo instance matching that URI in the holder, and returns it if exists.
static Mongo.Holder singleton()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mongo.Holder

public Mongo.Holder()
Method Detail

connect

public Mongo connect(MongoURI uri)
              throws MongoException,
                     UnknownHostException
Attempts to find an existing Mongo instance matching that URI in the holder, and returns it if exists. Otherwise creates a new Mongo instance based on this URI and adds it to the holder.

Parameters:
uri - the Mongo URI
Returns:
Throws:
MongoException
UnknownHostException

singleton

public static Mongo.Holder singleton()