作者 crossoverJie

:white_check_mark: Adding tests.

@@ -2,6 +2,7 @@ package com.crossoverjie.cim.client.client; @@ -2,6 +2,7 @@ package com.crossoverjie.cim.client.client;
2 2
3 import com.crossoverjie.cim.client.config.AppConfiguration; 3 import com.crossoverjie.cim.client.config.AppConfiguration;
4 import com.crossoverjie.cim.client.init.CIMClientHandleInitializer; 4 import com.crossoverjie.cim.client.init.CIMClientHandleInitializer;
  5 +import com.crossoverjie.cim.client.service.EchoService;
5 import com.crossoverjie.cim.client.service.MsgHandle; 6 import com.crossoverjie.cim.client.service.MsgHandle;
6 import com.crossoverjie.cim.client.service.RouteRequest; 7 import com.crossoverjie.cim.client.service.RouteRequest;
7 import com.crossoverjie.cim.client.service.impl.ClientInfo; 8 import com.crossoverjie.cim.client.service.impl.ClientInfo;
@@ -51,6 +52,9 @@ public class CIMClient { @@ -51,6 +52,9 @@ public class CIMClient {
51 private SocketChannel channel; 52 private SocketChannel channel;
52 53
53 @Autowired 54 @Autowired
  55 + private EchoService echoService ;
  56 +
  57 + @Autowired
54 private RouteRequest routeRequest; 58 private RouteRequest routeRequest;
55 59
56 @Autowired 60 @Autowired
@@ -108,6 +112,7 @@ public class CIMClient { @@ -108,6 +112,7 @@ public class CIMClient {
108 LOGGER.error("连接失败", e); 112 LOGGER.error("连接失败", e);
109 } 113 }
110 if (future.isSuccess()) { 114 if (future.isSuccess()) {
  115 + echoService.echo("start cim client success!");
111 LOGGER.info("启动 cim client 成功"); 116 LOGGER.info("启动 cim client 成功");
112 } 117 }
113 channel = (SocketChannel) future.channel(); 118 channel = (SocketChannel) future.channel();
@@ -137,7 +142,7 @@ public class CIMClient { @@ -137,7 +142,7 @@ public class CIMClient {
137 LOGGER.error("重连次数达到上限[{}]次", errorCount); 142 LOGGER.error("重连次数达到上限[{}]次", errorCount);
138 msgHandle.shutdown(); 143 msgHandle.shutdown();
139 } 144 }
140 - LOGGER.error("登录失败", e); 145 + LOGGER.error("login fail", e);
141 } 146 }
142 return cimServer; 147 return cimServer;
143 } 148 }
@@ -153,7 +158,8 @@ public class CIMClient { @@ -153,7 +158,8 @@ public class CIMClient {
153 .build(); 158 .build();
154 ChannelFuture future = channel.writeAndFlush(login); 159 ChannelFuture future = channel.writeAndFlush(login);
155 future.addListener((ChannelFutureListener) channelFuture -> 160 future.addListener((ChannelFutureListener) channelFuture ->
156 - LOGGER.info("注册成功={}", login.toString())); 161 + echoService.echo("registry cim server success!")
  162 + );
157 } 163 }
158 164
159 /** 165 /**
1 package com.crossoverjie.cim.client.scanner; 1 package com.crossoverjie.cim.client.scanner;
2 2
3 import com.crossoverjie.cim.client.config.AppConfiguration; 3 import com.crossoverjie.cim.client.config.AppConfiguration;
  4 +import com.crossoverjie.cim.client.service.EchoService;
4 import com.crossoverjie.cim.client.service.MsgHandle; 5 import com.crossoverjie.cim.client.service.MsgHandle;
5 import com.crossoverjie.cim.client.service.MsgLogger; 6 import com.crossoverjie.cim.client.service.MsgLogger;
6 import com.crossoverjie.cim.client.util.SpringBeanFactory; 7 import com.crossoverjie.cim.client.util.SpringBeanFactory;
@@ -30,10 +31,13 @@ public class Scan implements Runnable { @@ -30,10 +31,13 @@ public class Scan implements Runnable {
30 31
31 private MsgLogger msgLogger ; 32 private MsgLogger msgLogger ;
32 33
  34 + private EchoService echoService ;
  35 +
33 public Scan() { 36 public Scan() {
34 this.configuration = SpringBeanFactory.getBean(AppConfiguration.class); 37 this.configuration = SpringBeanFactory.getBean(AppConfiguration.class);
35 this.msgHandle = SpringBeanFactory.getBean(MsgHandle.class) ; 38 this.msgHandle = SpringBeanFactory.getBean(MsgHandle.class) ;
36 this.msgLogger = SpringBeanFactory.getBean(MsgLogger.class) ; 39 this.msgLogger = SpringBeanFactory.getBean(MsgLogger.class) ;
  40 + this.echoService = SpringBeanFactory.getBean(EchoService.class) ;
37 } 41 }
38 42
39 @Override 43 @Override
@@ -58,7 +62,7 @@ public class Scan implements Runnable { @@ -58,7 +62,7 @@ public class Scan implements Runnable {
58 //写入聊天记录 62 //写入聊天记录
59 msgLogger.log(msg) ; 63 msgLogger.log(msg) ;
60 64
61 - System.out.println(configuration.getUserName() + ":" + EmojiParser.parseToUnicode(msg)); 65 + echoService.echo(EmojiParser.parseToUnicode(msg));
62 } 66 }
63 } 67 }
64 68
  1 +package com.crossoverjie.cim.client.service;
  2 +
  3 +/**
  4 + * Function:
  5 + *
  6 + * @author crossoverJie
  7 + * Date: 2019-08-27 22:35
  8 + * @since JDK 1.8
  9 + */
  10 +public interface EchoService {
  11 +
  12 + /**
  13 + * echo msg to terminal
  14 + * @param msg message
  15 + * @param replace
  16 + */
  17 + void echo(String msg, String... replace) ;
  18 +}
  1 +package com.crossoverjie.cim.client.service.impl;
  2 +
  3 +import com.crossoverjie.cim.client.config.AppConfiguration;
  4 +import com.crossoverjie.cim.client.service.EchoService;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +/**
  9 + * Function:
  10 + *
  11 + * @author crossoverJie
  12 + * Date: 2019-08-27 22:37
  13 + * @since JDK 1.8
  14 + */
  15 +@Service
  16 +public class EchoServiceImpl implements EchoService {
  17 +
  18 + private static final String PREFIX = "$";
  19 +
  20 + @Autowired
  21 + private AppConfiguration appConfiguration;
  22 +
  23 + @Override
  24 + public void echo(String msg,String... replace) {
  25 + msg = "\033[31;4m" + appConfiguration.getUserName() + PREFIX + "\033[0m" + " " + msg;
  26 +
  27 + for (String str : replace) {
  28 +// msg.replaceAll("{}",str) ;
  29 + }
  30 + System.out.println(msg);
  31 + }
  32 +}
@@ -16,7 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -16,7 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.stereotype.Service; 16 import org.springframework.stereotype.Service;
17 17
18 import javax.annotation.Resource; 18 import javax.annotation.Resource;
19 -import java.util.Map;  
20 import java.util.concurrent.ThreadPoolExecutor; 19 import java.util.concurrent.ThreadPoolExecutor;
21 import java.util.concurrent.TimeUnit; 20 import java.util.concurrent.TimeUnit;
22 21
@@ -174,13 +173,4 @@ public class MsgHandler implements MsgHandle { @@ -174,13 +173,4 @@ public class MsgHandler implements MsgHandle {
174 aiModel = false ; 173 aiModel = false ;
175 } 174 }
176 175
177 - private void printAllCommand(Map<String, String> allStatusCode) {  
178 - LOGGER.warn("====================================");  
179 - for (Map.Entry<String, String> stringStringEntry : allStatusCode.entrySet()) {  
180 - String key = stringStringEntry.getKey();  
181 - String value = stringStringEntry.getValue();  
182 - LOGGER.warn(key + "----->" + value);  
183 - }  
184 - LOGGER.warn("====================================");  
185 - }  
186 } 176 }
@@ -3,6 +3,7 @@ package com.crossoverjie.cim.client.service.impl; @@ -3,6 +3,7 @@ package com.crossoverjie.cim.client.service.impl;
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject; 4 import com.alibaba.fastjson.JSONObject;
5 import com.crossoverjie.cim.client.config.AppConfiguration; 5 import com.crossoverjie.cim.client.config.AppConfiguration;
  6 +import com.crossoverjie.cim.client.service.EchoService;
6 import com.crossoverjie.cim.client.service.RouteRequest; 7 import com.crossoverjie.cim.client.service.RouteRequest;
7 import com.crossoverjie.cim.client.vo.req.GroupReqVO; 8 import com.crossoverjie.cim.client.vo.req.GroupReqVO;
8 import com.crossoverjie.cim.client.vo.req.LoginReqVO; 9 import com.crossoverjie.cim.client.vo.req.LoginReqVO;
@@ -50,6 +51,8 @@ public class RouteRequestImpl implements RouteRequest { @@ -50,6 +51,8 @@ public class RouteRequestImpl implements RouteRequest {
50 @Value("${cim.server.online.user.url}") 51 @Value("${cim.server.online.user.url}")
51 private String onlineUserUrl; 52 private String onlineUserUrl;
52 53
  54 + @Autowired
  55 + private EchoService echoService ;
53 56
54 57
55 @Autowired 58 @Autowired
@@ -136,7 +139,7 @@ public class RouteRequestImpl implements RouteRequest { @@ -136,7 +139,7 @@ public class RouteRequestImpl implements RouteRequest {
136 139
137 //重复失败 140 //重复失败
138 if (!cimServerResVO.getCode().equals(StatusEnum.SUCCESS.getCode())){ 141 if (!cimServerResVO.getCode().equals(StatusEnum.SUCCESS.getCode())){
139 - LOGGER.error(appConfiguration.getUserName() + ":" + cimServerResVO.getMessage()); 142 + echoService.echo(cimServerResVO.getMessage());
140 System.exit(-1); 143 System.exit(-1);
141 } 144 }
142 145
1 package com.crossoverjie.cim.client.service.impl.command; 1 package com.crossoverjie.cim.client.service.impl.command;
2 2
  3 +import com.crossoverjie.cim.client.service.EchoService;
3 import com.crossoverjie.cim.client.service.InnerCommand; 4 import com.crossoverjie.cim.client.service.InnerCommand;
4 import com.crossoverjie.cim.common.enums.SystemCommandEnum; 5 import com.crossoverjie.cim.common.enums.SystemCommandEnum;
5 import org.slf4j.Logger; 6 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory; 7 import org.slf4j.LoggerFactory;
  8 +import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
8 10
9 import java.util.Map; 11 import java.util.Map;
@@ -19,15 +21,18 @@ import java.util.Map; @@ -19,15 +21,18 @@ import java.util.Map;
19 public class PrintAllCommand implements InnerCommand { 21 public class PrintAllCommand implements InnerCommand {
20 private final static Logger LOGGER = LoggerFactory.getLogger(PrintAllCommand.class); 22 private final static Logger LOGGER = LoggerFactory.getLogger(PrintAllCommand.class);
21 23
  24 + @Autowired
  25 + private EchoService echoService ;
  26 +
22 @Override 27 @Override
23 public void process(String msg) { 28 public void process(String msg) {
24 Map<String, String> allStatusCode = SystemCommandEnum.getAllStatusCode(); 29 Map<String, String> allStatusCode = SystemCommandEnum.getAllStatusCode();
25 - LOGGER.warn("===================================="); 30 + echoService.echo("====================================");
26 for (Map.Entry<String, String> stringStringEntry : allStatusCode.entrySet()) { 31 for (Map.Entry<String, String> stringStringEntry : allStatusCode.entrySet()) {
27 String key = stringStringEntry.getKey(); 32 String key = stringStringEntry.getKey();
28 String value = stringStringEntry.getValue(); 33 String value = stringStringEntry.getValue();
29 - LOGGER.warn(key + "----->" + value); 34 + echoService.echo(key + "----->" + value);
30 } 35 }
31 - LOGGER.warn("===================================="); 36 + echoService.echo("====================================");
32 } 37 }
33 } 38 }
1 package com.crossoverjie.cim.client.service.impl.command; 1 package com.crossoverjie.cim.client.service.impl.command;
2 2
  3 +import com.crossoverjie.cim.client.service.EchoService;
3 import com.crossoverjie.cim.client.service.InnerCommand; 4 import com.crossoverjie.cim.client.service.InnerCommand;
4 import com.crossoverjie.cim.client.service.RouteRequest; 5 import com.crossoverjie.cim.client.service.RouteRequest;
5 import com.crossoverjie.cim.client.vo.res.OnlineUsersResVO; 6 import com.crossoverjie.cim.client.vo.res.OnlineUsersResVO;
@@ -25,16 +26,19 @@ public class PrintOnlineUsersCommand implements InnerCommand { @@ -25,16 +26,19 @@ public class PrintOnlineUsersCommand implements InnerCommand {
25 @Autowired 26 @Autowired
26 private RouteRequest routeRequest ; 27 private RouteRequest routeRequest ;
27 28
  29 + @Autowired
  30 + private EchoService echoService ;
  31 +
28 @Override 32 @Override
29 public void process(String msg) { 33 public void process(String msg) {
30 try { 34 try {
31 List<OnlineUsersResVO.DataBodyBean> onlineUsers = routeRequest.onlineUsers(); 35 List<OnlineUsersResVO.DataBodyBean> onlineUsers = routeRequest.onlineUsers();
32 36
33 - LOGGER.info("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); 37 + echoService.echo("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
34 for (OnlineUsersResVO.DataBodyBean onlineUser : onlineUsers) { 38 for (OnlineUsersResVO.DataBodyBean onlineUser : onlineUsers) {
35 LOGGER.info("userId={}=====userName={}", onlineUser.getUserId(), onlineUser.getUserName()); 39 LOGGER.info("userId={}=====userName={}", onlineUser.getUserId(), onlineUser.getUserName());
36 } 40 }
37 - LOGGER.info("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); 41 + echoService.echo("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
38 42
39 } catch (Exception e) { 43 } catch (Exception e) {
40 LOGGER.error("Exception", e); 44 LOGGER.error("Exception", e);
1 package com.crossoverjie.cim.client.service.impl.command; 1 package com.crossoverjie.cim.client.service.impl.command;
2 2
  3 +import com.crossoverjie.cim.client.service.EchoService;
3 import com.crossoverjie.cim.client.service.InnerCommand; 4 import com.crossoverjie.cim.client.service.InnerCommand;
4 import com.crossoverjie.cim.client.service.MsgLogger; 5 import com.crossoverjie.cim.client.service.MsgLogger;
5 import org.slf4j.Logger; 6 import org.slf4j.Logger;
@@ -22,6 +23,9 @@ public class QueryHistoryCommand implements InnerCommand { @@ -22,6 +23,9 @@ public class QueryHistoryCommand implements InnerCommand {
22 @Autowired 23 @Autowired
23 private MsgLogger msgLogger ; 24 private MsgLogger msgLogger ;
24 25
  26 + @Autowired
  27 + private EchoService echoService ;
  28 +
25 @Override 29 @Override
26 public void process(String msg) { 30 public void process(String msg) {
27 String[] split = msg.split(" "); 31 String[] split = msg.split(" ");
@@ -29,6 +33,6 @@ public class QueryHistoryCommand implements InnerCommand { @@ -29,6 +33,6 @@ public class QueryHistoryCommand implements InnerCommand {
29 return; 33 return;
30 } 34 }
31 String res = msgLogger.query(split[1]); 35 String res = msgLogger.query(split[1]);
32 - System.out.println(res); 36 + echoService.echo(res);
33 } 37 }
34 } 38 }
1 package com.crossoverjie.cim.client.service.impl.command; 1 package com.crossoverjie.cim.client.service.impl.command;
2 2
3 import com.crossoverjie.cim.client.client.CIMClient; 3 import com.crossoverjie.cim.client.client.CIMClient;
  4 +import com.crossoverjie.cim.client.service.EchoService;
4 import com.crossoverjie.cim.client.service.InnerCommand; 5 import com.crossoverjie.cim.client.service.InnerCommand;
5 import com.crossoverjie.cim.client.service.MsgLogger; 6 import com.crossoverjie.cim.client.service.MsgLogger;
6 import com.crossoverjie.cim.client.service.RouteRequest; 7 import com.crossoverjie.cim.client.service.RouteRequest;
@@ -37,25 +38,29 @@ public class ShutDownCommand implements InnerCommand { @@ -37,25 +38,29 @@ public class ShutDownCommand implements InnerCommand {
37 @Resource(name = "callBackThreadPool") 38 @Resource(name = "callBackThreadPool")
38 private ThreadPoolExecutor executor; 39 private ThreadPoolExecutor executor;
39 40
  41 + @Autowired
  42 + private EchoService echoService ;
  43 +
40 44
41 @Autowired 45 @Autowired
42 private ShutDownMsg shutDownMsg ; 46 private ShutDownMsg shutDownMsg ;
43 47
44 @Override 48 @Override
45 public void process(String msg) { 49 public void process(String msg) {
46 - LOGGER.info("系统关闭中。。。。"); 50 + echoService.echo("cim client closing...");
47 shutDownMsg.shutdown(); 51 shutDownMsg.shutdown();
48 routeRequest.offLine(); 52 routeRequest.offLine();
49 msgLogger.stop(); 53 msgLogger.stop();
50 executor.shutdown(); 54 executor.shutdown();
51 try { 55 try {
52 while (!executor.awaitTermination(1, TimeUnit.SECONDS)) { 56 while (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
53 - LOGGER.info("线程池关闭中。。。。"); 57 + echoService.echo("thread pool closing");
54 } 58 }
55 cimClient.close(); 59 cimClient.close();
56 } catch (InterruptedException e) { 60 } catch (InterruptedException e) {
57 LOGGER.error("InterruptedException", e); 61 LOGGER.error("InterruptedException", e);
58 } 62 }
  63 + echoService.echo("cim close success!");
59 System.exit(0); 64 System.exit(0);
60 } 65 }
61 } 66 }
@@ -13,40 +13,40 @@ cim.msg.logger.path = /opt/logs/cim/ @@ -13,40 +13,40 @@ cim.msg.logger.path = /opt/logs/cim/
13 13
14 14
15 ###=======生产模拟======### 15 ###=======生产模拟======###
16 -# 群发消息  
17 -cim.group.route.request.url=http://45.78.28.220:8083/groupRoute  
18 -  
19 -# 私聊消息  
20 -cim.p2p.route.request.url=http://45.78.28.220:8083/p2pRoute  
21 -  
22 -# 登录并获取服务器ip+port  
23 -cim.server.route.request.url=http://45.78.28.220:8083/login  
24 -  
25 -# 在线用户  
26 -cim.server.online.user.url=http://45.78.28.220:8083/onlineUser  
27 -  
28 -# 清除路由信息  
29 -cim.clear.route.request.url=http://45.78.28.220:8083/offLine  
30 -  
31 -###=======本地模拟======###  
32 ## 群发消息 16 ## 群发消息
33 -#cim.group.route.request.url=http://localhost:8083/groupRoute 17 +#cim.group.route.request.url=http://45.78.28.220:8083/groupRoute
34 # 18 #
35 ## 私聊消息 19 ## 私聊消息
36 -#cim.p2p.route.request.url=http://localhost:8083/p2pRoute 20 +#cim.p2p.route.request.url=http://45.78.28.220:8083/p2pRoute
37 # 21 #
38 ## 登录并获取服务器ip+port 22 ## 登录并获取服务器ip+port
39 -#cim.server.route.request.url=http://localhost:8083/login 23 +#cim.server.route.request.url=http://45.78.28.220:8083/login
40 # 24 #
41 ## 在线用户 25 ## 在线用户
42 -#cim.server.online.user.url=http://localhost:8083/onlineUser 26 +#cim.server.online.user.url=http://45.78.28.220:8083/onlineUser
  27 +#
  28 +## 清除路由信息
  29 +#cim.clear.route.request.url=http://45.78.28.220:8083/offLine
  30 +
  31 +###=======本地模拟======###
  32 +# 群发消息
  33 +cim.group.route.request.url=http://localhost:8083/groupRoute
  34 +
  35 +# 私聊消息
  36 +cim.p2p.route.request.url=http://localhost:8083/p2pRoute
  37 +
  38 +# 登录并获取服务器ip+port
  39 +cim.server.route.request.url=http://localhost:8083/login
  40 +
  41 +# 在线用户
  42 +cim.server.online.user.url=http://localhost:8083/onlineUser
43 43
44 -# 清除路由信息  
45 -#cim.clear.route.request.url=http://localhost:8083/offLine 44 + 清除路由信息
  45 +cim.clear.route.request.url=http://localhost:8083/offLine
46 46
47 # 客户端唯一ID 47 # 客户端唯一ID
48 -cim.user.id=1551267098213  
49 -cim.user.userName=test3 48 +cim.user.id=1566914867344
  49 +cim.user.userName=zhangsan
50 50
51 # 回调线程队列大小 51 # 回调线程队列大小
52 cim.callback.thread.queue.size = 2 52 cim.callback.thread.queue.size = 2
  1 +package com.crossoverjie.cim.server.test;
  2 +
  3 +import org.junit.Assert;
  4 +import org.junit.Test;
  5 +
  6 +/**
  7 + * Function:
  8 + *
  9 + * @author crossoverJie
  10 + * Date: 2019-08-28 01:47
  11 + * @since JDK 1.8
  12 + */
  13 +public class EchoTest {
  14 + @Test
  15 + public void echo() {
  16 + String msg = "{} say,you {}";
  17 + String[] place = {"zhangsan", "haha"};
  18 +
  19 + String log = log(msg, place);
  20 + System.out.println(log);
  21 + Assert.assertEquals(log,"zhangsan say,you haha");
  22 + }
  23 +
  24 + @Test
  25 + public void echo2() {
  26 + String msg = "{} say,you {},zhangsan say {}";
  27 + String[] place = {"zhangsan", "haha", "nihao"};
  28 +
  29 + String log = log(msg, place);
  30 + System.out.println(log);
  31 + Assert.assertEquals(log,"zhangsan say,you haha,zhangsan say nihao");
  32 + }
  33 +
  34 + @Test
  35 + public void echo3() {
  36 + String msg = "see you {},zhangsan say";
  37 + String[] place = {"zhangsan"};
  38 +
  39 + String log = log(msg, place);
  40 + System.out.println(log);
  41 + Assert.assertEquals(log,"see you zhangsan,zhangsan say");
  42 + }
  43 + @Test
  44 + public void echo4() {
  45 + String msg = "{}see you,zhangsan say";
  46 + String[] place = {"!!!"};
  47 +
  48 + String log = log(msg, place);
  49 + System.out.println(log);
  50 + Assert.assertEquals(log,"!!!see you,zhangsan say");
  51 + }
  52 + @Test
  53 + public void echo5() {
  54 + String msg = "see you,zhangsan say{}";
  55 + String[] place = {"!!!"};
  56 +
  57 + String log = log(msg, place);
  58 + System.out.println(log);
  59 + Assert.assertEquals(log,"see you,zhangsan say!!!");
  60 + }
  61 +
  62 + @Test
  63 + public void echo6() {
  64 + String msg = "see you,zhangsan say";
  65 + String[] place = {""};
  66 +
  67 + String log = log(msg, place);
  68 + System.out.println(log);
  69 + Assert.assertEquals(log,"see you,zhangsan say");
  70 + }
  71 +
  72 + private String log(String msg, String... place) {
  73 + StringBuilder sb = new StringBuilder();
  74 + int k = 0;
  75 + for (int i = 0; i < place.length; i++) {
  76 + int index = msg.indexOf("{}", k);
  77 +
  78 + if (index == -1){
  79 + return msg;
  80 + }
  81 +
  82 + if (index != 0) {
  83 + sb.append(msg, k, index);
  84 + sb.append(place[i]);
  85 +
  86 + if (place.length == 1) {
  87 + sb.append(msg, index + 2, msg.length());
  88 + }
  89 +
  90 + } else {
  91 + sb.append(place[i]);
  92 + if (place.length == 1) {
  93 + sb.append(msg, index + 2, msg.length());
  94 + }
  95 + }
  96 +
  97 + k = index + 2;
  98 + }
  99 + return sb.toString();
  100 + }
  101 +}
@@ -25,7 +25,7 @@ monitor.channel.map.key=channelMap @@ -25,7 +25,7 @@ monitor.channel.map.key=channelMap
25 app.zk.switch=true 25 app.zk.switch=true
26 26
27 # zk 地址 27 # zk 地址
28 -app.zk.addr=47.98.194.60:2182 28 +app.zk.addr=ip:port
29 29
30 # zk 连接超时时限 30 # zk 连接超时时限
31 app.zk.connect.timeout=15000 31 app.zk.connect.timeout=15000
@@ -36,5 +36,5 @@ app.zk.root=/route @@ -36,5 +36,5 @@ app.zk.root=/route
36 # 清除路由信息 36 # 清除路由信息
37 cim.clear.route.request.url=http://localhost:8083/offLine 37 cim.clear.route.request.url=http://localhost:8083/offLine
38 38
39 -# 检测多少秒没有收到客户端心跳后服务端关闭连接 39 +# 检测多少秒没有收到客户端心跳后服务端关闭连接 单位秒
40 cim.heartbeat.time = 30 40 cim.heartbeat.time = 30