修改配置文件
parent
562a4678df
commit
c20bb4ec0c
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<gameSetting>
|
||||
<host>8.138.242.190</host>
|
||||
<intranet>8.138.242.190</intranet>
|
||||
<host>127.0.0.1</host>
|
||||
<intranet>127.0.0.1</intranet>
|
||||
<port>8701</port>
|
||||
<serverId>7701</serverId>
|
||||
<serverId>8701</serverId>
|
||||
<gameId>10</gameId>
|
||||
<loggerDebug>true</loggerDebug>
|
||||
</gameSetting>
|
||||
|
|
@ -8,17 +8,17 @@
|
|||
|
||||
<poolConfig>
|
||||
<!-- 最大连接数, 默认8个 -->
|
||||
<maxTotal>80</maxTotal>
|
||||
<maxTotal>200</maxTotal>
|
||||
<!-- 最大空闲连接数, 默认8个 -->
|
||||
<maxIdle>20</maxIdle>
|
||||
<maxIdle>50</maxIdle>
|
||||
<!-- 最小空闲连接数, 默认0个 -->
|
||||
<minIdle>5</minIdle>
|
||||
<minIdle>20</minIdle>
|
||||
<!-- 获取连接时的最大等待毫秒数(如果设置为阻塞时BlockWhenExhausted),如果超时就抛异常, 小于零:阻塞不确定的时间, 默认-1 -->
|
||||
<maxWaitMillis>-1</maxWaitMillis>
|
||||
<maxWaitMillis>2000</maxWaitMillis>
|
||||
<!-- 在borrow一个jedis实例时,是否提前进行alidate操作, 默认false -->
|
||||
<testOnBorrow>true</testOnBorrow>
|
||||
<testOnBorrow>false</testOnBorrow>
|
||||
<!-- 在return给pool时,是否提前进行validate操作, 默认false -->
|
||||
<testOnReturn>true</testOnReturn>
|
||||
<testOnReturn>false</testOnReturn>
|
||||
<!-- 表示有一个idle object evitor线程对idle object进行扫描,如果validate失败,
|
||||
此object会被从pool中drop掉;这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义, 默认true -->
|
||||
<testWhileIdle>true</testWhileIdle>
|
||||
|
|
@ -36,19 +36,8 @@
|
|||
<!-- 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true -->
|
||||
<blockWhenExhausted>true</blockWhenExhausted>
|
||||
</poolConfig>
|
||||
|
||||
|
||||
<infos>
|
||||
<info name="group1_db0" host="8.138.242.190" password="cssq@2020" port="6379" database="0" timeout="5000"/>
|
||||
<info name="group1_db1" host="8.138.242.190" password="cssq@2020" port="6379" database="1" timeout="5000"/>
|
||||
<info name="group1_db2" host="8.138.242.190" password="cssq@2020" port="6379" database="2" timeout="5000"/>
|
||||
<info name="group1_db5" host="8.138.242.190" password="cssq@2020" port="6379" database="5" timeout="5000"/>
|
||||
<info name="group1_db8" host="8.138.242.190" password="cssq@2020" port="6379" database="8" timeout="5000"/>
|
||||
<info name="group1_db9" host="8.138.242.190" password="cssq@2020" port="6379" database="9" timeout="5000"/>
|
||||
<info name="group1_db10" host="8.138.242.190" password="cssq@2020" port="6379" database="10" timeout="5000"/>
|
||||
<info name="group1_db11" host="8.138.242.190" password="cssq@2020" port="6379" database="11" timeout="5000"/>
|
||||
<info name="tmp_group1_db9" host="8.138.242.190" password="654sads" port="6479" database="9" timeout="5000"/>
|
||||
</infos>
|
||||
<!--<infos>
|
||||
<info name="group1_db0" host="127.0.0.1" port="6379" database="0" timeout="5000"/>
|
||||
<info name="group1_db1" host="127.0.0.1" port="6379" database="1" timeout="5000"/>
|
||||
<info name="group1_db2" host="127.0.0.1" port="6379" database="2" timeout="5000"/>
|
||||
|
|
@ -57,6 +46,6 @@
|
|||
<info name="group1_db9" host="127.0.0.1" port="6379" database="9" timeout="5000"/>
|
||||
<info name="group1_db10" host="127.0.0.1" port="6379" database="10" timeout="5000"/>
|
||||
<info name="group1_db11" host="127.0.0.1" port="6379" database="11" timeout="5000"/>
|
||||
</infos>-->
|
||||
</infos>
|
||||
</plugin>
|
||||
</serivce-core>
|
||||
|
|
@ -10,16 +10,16 @@
|
|||
<!-- 最大的数据包大小 -->
|
||||
<maxPacketSize>524288</maxPacketSize>
|
||||
<!-- 最大读取缓存大小 -->
|
||||
<maxReadBufferSize>1024</maxReadBufferSize>
|
||||
<maxReadBufferSize>16384</maxReadBufferSize>
|
||||
<!-- 最大写入缓存大小 -->
|
||||
<maxWriteBufferSize>32768</maxWriteBufferSize>
|
||||
<!-- 会话队列的大小-->
|
||||
<sessionPacketQueueSize>160</sessionPacketQueueSize>
|
||||
<sessionPacketQueueSize>512</sessionPacketQueueSize>
|
||||
|
||||
<!-- Thread Pool Size of the 3 main stages of the Bitswarm Engine -->
|
||||
<socketAcceptorThreadPoolSize>1</socketAcceptorThreadPoolSize>
|
||||
<socketAcceptorThreadPoolSize>4</socketAcceptorThreadPoolSize>
|
||||
<socketReaderThreadPoolSize>2</socketReaderThreadPoolSize>
|
||||
<socketWriterThreadPoolSize>1</socketWriterThreadPoolSize>
|
||||
<socketWriterThreadPoolSize>2</socketWriterThreadPoolSize>
|
||||
|
||||
<!-- Enable disable Nagle algorithm on sockets, true == disable -->
|
||||
<tcpNoDelay>true</tcpNoDelay>
|
||||
|
|
@ -57,19 +57,19 @@
|
|||
<!-- The system thread pool config -->
|
||||
<systemThreadPoolConfig>
|
||||
<name>Sys</name>
|
||||
<corePoolSize>2</corePoolSize>
|
||||
<maxPoolSize>8</maxPoolSize>
|
||||
<corePoolSize>16</corePoolSize>
|
||||
<maxPoolSize>32</maxPoolSize>
|
||||
<keepAliveTime>60000</keepAliveTime>
|
||||
<maxQueueSize>20000</maxQueueSize>
|
||||
<maxQueueSize>5000</maxQueueSize>
|
||||
</systemThreadPoolConfig>
|
||||
|
||||
<!-- The extension thread pool config -->
|
||||
<extensionThreadPoolConfig>
|
||||
<name>Ext</name>
|
||||
<corePoolSize>2</corePoolSize>
|
||||
<maxPoolSize>8</maxPoolSize>
|
||||
<corePoolSize>16</corePoolSize>
|
||||
<maxPoolSize>32</maxPoolSize>
|
||||
<keepAliveTime>60000</keepAliveTime>
|
||||
<maxQueueSize>20000</maxQueueSize>
|
||||
<maxQueueSize>5000</maxQueueSize>
|
||||
</extensionThreadPoolConfig>
|
||||
|
||||
</server>
|
||||
|
|
@ -356,20 +356,7 @@ public class EXGameController extends GameController {
|
|||
robotRoomMapping.put(robotUser.getConnecId(), robotUser);
|
||||
robotConnectionManager.reconnectToGameServer(response, robotUser, client);
|
||||
});
|
||||
|
||||
//添加超时检查机制
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
//10秒后还没有建立映射关系 加入可能失败
|
||||
if (robotRoomMapping.get(robotUser.getConnecId()) == null) {
|
||||
System.err.println("机器人{"+robotId+"}加入房间{"+roomId+"}超时,清理临时状态");
|
||||
robotConnectionManager.disconnectFromGameServer(connecId);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
});
|
||||
|
||||
System.err.println("已进入房间成功: " + robotUser.getConnecId());
|
||||
Thread.sleep(1000);
|
||||
if (client.isConnected()) {
|
||||
|
|
@ -381,6 +368,19 @@ public class EXGameController extends GameController {
|
|||
robotUser.setStatus(ROBOTEventType.ROBOT_INTOROOM_READY);
|
||||
robotConnectionManager.setSessionAndToken("{user}:" + robotId, robotSession, robotUser.getConnecId());
|
||||
}
|
||||
//添加超时检查机制
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
Thread.sleep(15000);
|
||||
//10秒后还没有建立映射关系 加入可能失败
|
||||
if (robotRoomMapping.get(robotUser.getConnecId()) == null) {
|
||||
System.err.println("机器人{"+robotId+"}加入房间{"+roomId+"}超时,清理临时状态");
|
||||
robotConnectionManager.disconnectFromGameServer(connecId);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
});
|
||||
robotUser.setIntoRoomTime(robotConnectionManager.getTime());
|
||||
System.err.println("已进入房间准备成功: " + robotUser.getConnecId());
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue