Package com.mongodb
Class Mongo.Holder
- java.lang.Object
-
- com.mongodb.Mongo.Holder
-
- Enclosing class:
- Mongo
Deprecated.
@Deprecated 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
Constructors Constructor Description Holder()
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Mongo
connect(MongoClientURI uri)
Deprecated.Attempts to find an existing MongoClient instance matching that URI in the holder, and returns it if exists.Mongo
connect(MongoURI uri)
Deprecated.Please useconnect(MongoClientURI)
instead.static Mongo.Holder
singleton()
Deprecated.Get the only instance ofHolder
.
-
-
-
Method Detail
-
singleton
public static Mongo.Holder singleton()
Deprecated.Get the only instance ofHolder
.- Returns:
- the singleton instance of
Holder
-
connect
@Deprecated public Mongo connect(MongoURI uri)
Deprecated. Please useconnect(MongoClientURI)
instead.Attempts to find an existing MongoClient 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:
- the client
- Throws:
MongoException
- if there's a failure
-
connect
public Mongo connect(MongoClientURI uri)
Deprecated.Attempts to find an existing MongoClient 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:
- the client
- Throws:
MongoException
- if there's a failure
-
-