Package com.mongodb

Class Mongo.Holder

  • Enclosing class:
    Mongo

    @Deprecated
    public static class Mongo.Holder
    extends Object
    Deprecated.
    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 Detail

      • Holder

        public Holder()
        Deprecated.
    • Method Detail

      • singleton

        public static Mongo.Holder singleton()
        Deprecated.
        Get the only instance of Holder.
        Returns:
        the singleton instance of Holder
      • connect

        @Deprecated
        public Mongo connect(MongoURI uri)
        Deprecated.
        Please use connect(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