@@ -0,0 +1,2040 @@
+package org.leonardo.ocean.db;%0A%0Aimport com.mongodb.MongoClient;%0Aimport com.mongodb.MongoClientOptions;%0Aimport com.mongodb.MongoCredential;%0Aimport com.mongodb.ServerAddress;%0A%0Aimport java.util.Arrays;%0A%0A/**%0A * Created by Leonardo - Ocean  on 2015/7/25.%0A * %CE%A8%D3%AB%D8%A5 mongodb su%0A */%0Apublic class ConnectionGenerator %7B%0A%0A    protected int connectionMultiplier = 300;%0A    protected int connectionsPerHost = 10;%0A    protected int connectTimeout = 5000;%0A    protected int defaultPort = 27017;%0A%0A    public ConnectionGenerator() %7B%0A       super();%0A    %7D%0A%0A%0A%0A    //u%7B%DD%BC%C6%B6q  * D%CC%A4jsu  = pool %C6%B6q%0A    private MongoClientOptions options()%7B%0A        return new MongoClientOptions.Builder()%0A                .threadsAllowedToBlockForConnectionMultiplier(connectionMultiplier)%09//u%7B%DD%AA%C6%B6q%0A                .connectionsPerHost(connectionsPerHost)%09%09%09%09%09%09%09%09//D%CC%A4jsu%0A                .connectTimeout(connectTimeout)%0A                .build();%0A    %7D%0A%0A    protected MongoClient connection(String host)%7B%0A        return connection(host, defaultPort);%0A    %7D%0A%0A    protected MongoClient connection(String host, int port)%7B%0A        MongoClient client = null;%0A        try%7B%0A            ServerAddress address = new ServerAddress(host, port);%0A            client = new MongoClient(address, options());%0A        %7Dcatch(Exception error) %7B%0A            if(client != null)%7B%0A                client.close();%0A            %7D%0A            throw error;%0A        %7D%0A        return client;%0A    %7D%0A%0A    /**%D2%ABsu%D8%A5*/%0A    protected MongoClient connection(String host, int port , String dbName, String user, String password)%7B%0A        MongoClient client = null;%0A        try %7B%0A            MongoCredential credential = MongoCredential.createMongoCRCredential(user, dbName, password.toCharArray());%0A            ServerAddress address = new ServerAddress(host, port);%0A            client = new MongoClient(address, Arrays.asList(credential), options());%0A%0A        %7Dcatch (Exception error)%7B%0A            if(client != null)%7B%0A                client.close();%0A            %7D%0A            throw error;%0A        %7D%0A        return client;%0A    %7D%0A%7D%0A

change Class name.