public static void destroy() {
        if (Mongo.DEFAULT_DATABASE != null) {
            synchronized (LOCK) {
                if (Mongo.DEFAULT_DATABASE != null) {
                    //销毁客户端，并将引用置空
                    Mongo.DEFAULT_CLIENT.close();
                    Mongo.DEFAULT_DATABASE = null;
                    Mongo.DEFAULT_CLIENT = null;
                }
            }
        } else {
            LOG.warn("Mongodb client is not initialized yet, nothing is need to destroy.");
        }
    }
public static void destroy ( ) { if ( Mongo . DEFAULT_DATABASE != null ) { synchronized ( LOCK ) { if ( Mongo . DEFAULT_DATABASE != null ) { Mongo . DEFAULT_CLIENT . close ( ) ; Mongo . DEFAULT_DATABASE = null ; Mongo . DEFAULT_CLIENT = null ; } } } else { LOG . warn ( "Mongodb client is not initialized yet, nothing is need to destroy." ) ; } }
Destroy MongoDB client if the client is initialized or else nothing will be done.
This method is thread-safe to be used concurrently with {@link #getOrInitDefaultDatabase()} and {@link #getOrInitDefaultDatabase(String, String)}