@@ -50,33 +50,26 @@ public void check() {
5050 return ;
5151 }
5252
53- Map <String , String > stringStringMap = checkExpectState ();
53+ Map <String , Object > stringStringMap = checkExpectState ();
5454 // 默认值
5555 String expectState = "other" ;
56- String allowReport = "1" ;
56+ boolean allowReport = true ;
5757
5858 if (stringStringMap != null ) {
59- expectState = stringStringMap .get ("exceptRunningStatus" );
60- allowReport = stringStringMap .get ("isAllowDateReport" );
61- if ("null" .equals (allowReport )){
62- allowReport = "1" ;
59+ expectState = stringStringMap .get ("exceptRunningStatus" ).toString ();
60+ if (null != stringStringMap .get ("isAllowDateReport" )) {
61+ allowReport = (boolean ) stringStringMap .get ("isAllowDateReport" );
6362 }
6463 }
6564
66- if (!agentState .isAllowReport (allowReport )) {
67- if (null == agentState .getAllowReport ()) {
68- DongTaiLog .info ("engine is not allowed to report data" );
69- agentState .setAllowReport (allowReport );
70- }
71- if (!allowReport .equals (agentState .getAllowReport ())) {
72- DongTaiLog .info ("engine is not allowed to report data" );
73- agentState .setAllowReport (allowReport );
74- engineManager .stop ();
75- }
76- } else if (agentState .isAllowReport (allowReport ) && !allowReport .equals (agentState .getAllowReport ())) {
65+ if (allowReport && !agentState .isAllowReport ()) {
7766 DongTaiLog .info ("engine is allowed to report data" );
7867 agentState .setAllowReport (allowReport );
7968 engineManager .start ();
69+ } else if (!allowReport && agentState .isAllowReport ()) {
70+ DongTaiLog .info ("engine is not allowed to report data" );
71+ agentState .setAllowReport (allowReport );
72+ engineManager .stop ();
8073 }
8174
8275 if (!agentState .isFallback () && !agentState .isException () && agentState .isAllowReport () && agentState .isAllowReport ()) {
@@ -97,15 +90,15 @@ public void check() {
9790 }
9891 }
9992
100- private Map <String , String > checkExpectState () {
93+ private Map <String , Object > checkExpectState () {
10194 try {
10295 Map <String , String > parameters = new HashMap <String , String >();
10396 parameters .put ("agentId" , String .valueOf (AgentRegisterReport .getAgentId ()));
10497 String respRaw = HttpClientUtils .sendGet (ApiPath .EXCEPT_ACTION , parameters ).toString ();
10598 if (!respRaw .isEmpty ()) {
10699 JSONObject resp = JSON .parseObject (respRaw );
107100 JSONObject data = (JSONObject ) resp .get ("data" );
108- Map <String , String > objectObjectHashMap = new HashMap <>(2 );
101+ Map <String , Object > objectObjectHashMap = new HashMap <>(2 );
109102 String s = data .toJSONString ();
110103 objectObjectHashMap = JSON .parseObject (s , Map .class );
111104 return objectObjectHashMap ;
0 commit comments