mongo配置修改
parent
23d17dc479
commit
be862b5e17
|
|
@ -36,6 +36,8 @@ public class ServerProperties {
|
|||
|
||||
private boolean arenaCross;
|
||||
|
||||
private int threads;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
@ -148,6 +150,18 @@ public class ServerProperties {
|
|||
this.arenaCross = arenaCross;
|
||||
}
|
||||
|
||||
public int getThreads() {
|
||||
if (threads <= 0){
|
||||
threads = 8;
|
||||
}
|
||||
System.out.println("游戏线程数量:"+threads);
|
||||
return threads;
|
||||
}
|
||||
|
||||
public void setThreads(int threads) {
|
||||
this.threads = threads;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServerProperties{" +
|
||||
|
|
@ -164,6 +178,8 @@ public class ServerProperties {
|
|||
", debug=" + debug +
|
||||
", logDir='" + logDir + '\'' +
|
||||
", appId='" + appId + '\'' +
|
||||
", arenaCross=" + arenaCross +
|
||||
", threads=" + threads +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ public class MongoConfig {
|
|||
builder.minConnectionsPerHost(mongoSettingsProperties.getMinConnectionsPerHost());
|
||||
builder.maxWaitTime(mongoSettingsProperties.getMaxWaitTime());
|
||||
builder.socketTimeout(mongoSettingsProperties.getSocketTimeout());
|
||||
builder.maxConnectionIdleTime(mongoSettingsProperties.getMaxConnectionIdleTime());
|
||||
MongoClientURI mongoClientURI = new MongoClientURI(MONGO_URI,builder);
|
||||
MongoDbFactory mongoDbFactory = null;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
private static ProtocolsManager instance = new ProtocolsManager();
|
||||
private Map<Integer, BaseHandler> handlers = new HashMap<>();
|
||||
private static ClassLoader classLoader = GameApplication.class.getClassLoader();
|
||||
public final static int HANDLER_THREAD_NUM = 50;
|
||||
public static HandlerLogicThread[] handlerThreads = new HandlerLogicThread[HANDLER_THREAD_NUM];
|
||||
public final static int HANDLER_THREAD_NUM = 8;
|
||||
public static HandlerLogicThread[] handlerThreads = new HandlerLogicThread[HANDLER_THREAD_NUM];
|
||||
|
||||
static {
|
||||
initContext();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ server.logDir = D:\\jl_logs
|
|||
server.guildFight = false
|
||||
server.sendlog37 = true
|
||||
server.channel = test
|
||||
server.threads = 8
|
||||
# redis config
|
||||
# Redis数据库索引(默认为0)
|
||||
spring.redis.database=0
|
||||
|
|
@ -41,7 +42,7 @@ mongodb.options.maxWaitTime = 120000
|
|||
mongodb.options.connectTimeout = 1000
|
||||
mongodb.options.socketTimeout = 0
|
||||
mongodb.options.threadsAllowedToBlockForConnectionMultiplier = 20
|
||||
mongodb.options.connectionsPerHost = 256
|
||||
mongodb.options.connectionsPerHost = 50
|
||||
mongodb.options.minConnectionsPerHost = 5
|
||||
mongodb.options.maxConnectionIdleTime = 1000
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue