|
1
|
package com.crossoverjie.cim.client.service.impl;
|
1
|
package com.crossoverjie.cim.client.service.impl;
|
|
2
|
|
2
|
|
|
|
|
3
|
+import com.crossoverjie.cim.client.client.CIMClient;
|
|
3
|
import com.crossoverjie.cim.client.service.MsgHandle;
|
4
|
import com.crossoverjie.cim.client.service.MsgHandle;
|
|
4
|
import com.crossoverjie.cim.client.service.RouteRequest;
|
5
|
import com.crossoverjie.cim.client.service.RouteRequest;
|
|
5
|
import com.crossoverjie.cim.client.vo.req.GroupReqVO;
|
6
|
import com.crossoverjie.cim.client.vo.req.GroupReqVO;
|
|
@@ -12,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
@@ -12,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
12
|
import org.springframework.stereotype.Service;
|
13
|
import org.springframework.stereotype.Service;
|
|
13
|
|
14
|
|
|
14
|
import java.util.Map;
|
15
|
import java.util.Map;
|
|
|
|
16
|
+import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
17
|
+import java.util.concurrent.TimeUnit;
|
|
15
|
|
18
|
|
|
16
|
/**
|
19
|
/**
|
|
17
|
* Function:
|
20
|
* Function:
|
|
@@ -26,6 +29,13 @@ public class MsgHandler implements MsgHandle { |
|
@@ -26,6 +29,13 @@ public class MsgHandler implements MsgHandle { |
|
26
|
@Autowired
|
29
|
@Autowired
|
|
27
|
private RouteRequest routeRequest ;
|
30
|
private RouteRequest routeRequest ;
|
|
28
|
|
31
|
|
|
|
|
32
|
+
|
|
|
|
33
|
+ @Autowired
|
|
|
|
34
|
+ private ThreadPoolExecutor executor ;
|
|
|
|
35
|
+
|
|
|
|
36
|
+ @Autowired
|
|
|
|
37
|
+ private CIMClient cimClient ;
|
|
|
|
38
|
+
|
|
29
|
@Override
|
39
|
@Override
|
|
30
|
public void groupChat(GroupReqVO groupReqVO) throws Exception {
|
40
|
public void groupChat(GroupReqVO groupReqVO) throws Exception {
|
|
31
|
routeRequest.sendGroupMsg(groupReqVO);
|
41
|
routeRequest.sendGroupMsg(groupReqVO);
|
|
@@ -52,8 +62,8 @@ public class MsgHandler implements MsgHandle { |
|
@@ -52,8 +62,8 @@ public class MsgHandler implements MsgHandle { |
|
52
|
Map<String, String> allStatusCode = SystemCommandEnumType.getAllStatusCode();
|
62
|
Map<String, String> allStatusCode = SystemCommandEnumType.getAllStatusCode();
|
|
53
|
|
63
|
|
|
54
|
if (SystemCommandEnumType.QUIT.getCommandType().trim().equals(msg)){
|
64
|
if (SystemCommandEnumType.QUIT.getCommandType().trim().equals(msg)){
|
|
55
|
- LOGGER.info("系统关闭中。。。。");
|
|
|
|
56
|
- System.exit(0);
|
65
|
+ //关闭系统
|
|
|
|
66
|
+ shutdown();
|
|
57
|
} else if (SystemCommandEnumType.ALL.getCommandType().trim().equals(msg)){
|
67
|
} else if (SystemCommandEnumType.ALL.getCommandType().trim().equals(msg)){
|
|
58
|
printAllCommand(allStatusCode);
|
68
|
printAllCommand(allStatusCode);
|
|
59
|
}else {
|
69
|
}else {
|
|
@@ -69,6 +79,23 @@ public class MsgHandler implements MsgHandle { |
|
@@ -69,6 +79,23 @@ public class MsgHandler implements MsgHandle { |
|
69
|
|
79
|
|
|
70
|
}
|
80
|
}
|
|
71
|
|
81
|
|
|
|
|
82
|
+ /**
|
|
|
|
83
|
+ * 关闭系统
|
|
|
|
84
|
+ */
|
|
|
|
85
|
+ private void shutdown() {
|
|
|
|
86
|
+ LOGGER.info("系统关闭中。。。。");
|
|
|
|
87
|
+ executor.shutdown();
|
|
|
|
88
|
+ try {
|
|
|
|
89
|
+ while (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
|
|
|
|
90
|
+ LOGGER.info("线程池关闭中。。。。");
|
|
|
|
91
|
+ }
|
|
|
|
92
|
+ cimClient.close();
|
|
|
|
93
|
+ } catch (InterruptedException e) {
|
|
|
|
94
|
+ LOGGER.error("InterruptedException",e);
|
|
|
|
95
|
+ }
|
|
|
|
96
|
+ System.exit(0);
|
|
|
|
97
|
+ }
|
|
|
|
98
|
+
|
|
72
|
private void printAllCommand(Map<String, String> allStatusCode) {
|
99
|
private void printAllCommand(Map<String, String> allStatusCode) {
|
|
73
|
LOGGER.warn("====================================");
|
100
|
LOGGER.warn("====================================");
|
|
74
|
for (Map.Entry<String, String> stringStringEntry : allStatusCode.entrySet()) {
|
101
|
for (Map.Entry<String, String> stringStringEntry : allStatusCode.entrySet()) {
|