update
This commit is contained in:
+4
-4
@@ -20,13 +20,13 @@ public class SpringMongoConfig {
|
|||||||
public @Bean MongoDbFactory mongoDbFactory() throws Exception {
|
public @Bean MongoDbFactory mongoDbFactory() throws Exception {
|
||||||
List<ServerAddress> seeds = Arrays.asList(new ServerAddress("mongo.db.fangjia.com", 27017));
|
List<ServerAddress> seeds = Arrays.asList(new ServerAddress("mongo.db.fangjia.com", 27017));
|
||||||
MongoClientOptions.Builder builder = new MongoClientOptions.Builder();
|
MongoClientOptions.Builder builder = new MongoClientOptions.Builder();
|
||||||
int connPerHost = 20;
|
int connPerHost = 10;
|
||||||
builder.connectionsPerHost(connPerHost);
|
builder.connectionsPerHost(connPerHost);
|
||||||
int threadCount = 20;
|
int threadCount = 10;
|
||||||
builder.threadsAllowedToBlockForConnectionMultiplier(threadCount);
|
builder.threadsAllowedToBlockForConnectionMultiplier(threadCount);
|
||||||
int maxWaitTime = 1000;
|
int maxWaitTime = 10000;
|
||||||
builder.maxWaitTime(maxWaitTime);
|
builder.maxWaitTime(maxWaitTime);
|
||||||
int timeOut = 1000;
|
int timeOut = 10000;
|
||||||
builder.connectTimeout(timeOut);
|
builder.connectTimeout(timeOut);
|
||||||
MongoClientOptions options = builder.build();
|
MongoClientOptions options = builder.build();
|
||||||
MongoClient mongoClient = new MongoClient(seeds, options);
|
MongoClient mongoClient = new MongoClient(seeds, options);
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
<property name="url" value="${spring.datasource.url}"/>
|
<property name="url" value="${spring.datasource.url}"/>
|
||||||
<property name="username" value="${spring.datasource.username}"/>
|
<property name="username" value="${spring.datasource.username}"/>
|
||||||
<property name="password" value="${spring.datasource.password}"/>
|
<property name="password" value="${spring.datasource.password}"/>
|
||||||
|
<property name="validationQuery" value="SELECT 1" />
|
||||||
|
<property name="testOnBorrow" value="true"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="cxytiandiJdbcTemplate" class="com.cxytiandi.jdbc.CxytiandiJdbcTemplate">
|
<bean id="cxytiandiJdbcTemplate" class="com.cxytiandi.jdbc.CxytiandiJdbcTemplate">
|
||||||
|
|||||||
Reference in New Issue
Block a user