|
@@ -175,16 +175,14 @@ public class WebSocketUtil {
|
|
|
}
|
|
|
sendArray.add(sendItem);
|
|
|
// 发送
|
|
|
- SendAndClear(id, sendArray);
|
|
|
+ SendBatch(id, sendArray);
|
|
|
}
|
|
|
|
|
|
// path
|
|
|
// ProcessFirstSend_path(Repository, id, sendArray);
|
|
|
ProcessFirstSend_path(Repository.objectData, id, sendArray);
|
|
|
|
|
|
- if (sendArray.size() > 0) {
|
|
|
- SendAndClear(id, sendArray);
|
|
|
- }
|
|
|
+ SendAndClear(id, sendArray);
|
|
|
}
|
|
|
};
|
|
|
WebSocketUtil.executor.execute(new Thread(runnable));
|
|
@@ -210,7 +208,7 @@ public class WebSocketUtil {
|
|
|
sendItem.put("data", data);
|
|
|
sendArray.add(sendItem);
|
|
|
// 发送
|
|
|
- SendAndClear(id, sendArray);
|
|
|
+ SendBatch(id, sendArray);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -242,7 +240,7 @@ public class WebSocketUtil {
|
|
|
sendItem.put("data", JSON);
|
|
|
sendArray.add(sendItem);
|
|
|
// 发送
|
|
|
- SendAndClear(id, sendArray);
|
|
|
+ SendBatch(id, sendArray);
|
|
|
}
|
|
|
ProcessFirstSend_path(sdv.value_object, id, sendArray);
|
|
|
}
|
|
@@ -257,7 +255,7 @@ public class WebSocketUtil {
|
|
|
sendItem.put("data", JSON);
|
|
|
sendArray.add(sendItem);
|
|
|
// 发送
|
|
|
- SendAndClear(id, sendArray);
|
|
|
+ SendBatch(id, sendArray);
|
|
|
}
|
|
|
if (sdv.value_array.isSingleValueSet) {
|
|
|
} else {
|
|
@@ -277,7 +275,7 @@ public class WebSocketUtil {
|
|
|
sendItem.put("data", JSON);
|
|
|
sendArray.add(sendItem);
|
|
|
// 发送
|
|
|
- SendAndClear(id, sendArray);
|
|
|
+ SendBatch(id, sendArray);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -293,7 +291,7 @@ public class WebSocketUtil {
|
|
|
sendItem.put("data", JSON);
|
|
|
sendArray.add(sendItem);
|
|
|
// 发送
|
|
|
- SendAndClear(id, sendArray);
|
|
|
+ SendBatch(id, sendArray);
|
|
|
}
|
|
|
}
|
|
|
} else if (sdv.value_object != null) {
|
|
@@ -305,13 +303,20 @@ public class WebSocketUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static void SendAndClear(String id, JSONArray sendArray) {
|
|
|
+ private static void SendBatch(String id, JSONArray sendArray) {
|
|
|
if (sendArray.size() > 16) {
|
|
|
WebSocketChannelPool.Send(id, sendArray);
|
|
|
sendArray.clear();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static void SendAndClear(String id, JSONArray sendArray) {
|
|
|
+ if (sendArray.size() > 0) {
|
|
|
+ WebSocketChannelPool.Send(id, sendArray);
|
|
|
+ sendArray.clear();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private static boolean pathMatch(List<JSONArray> pathList, JSONArray pathArray) {
|
|
|
boolean match = false;
|
|
|
for (JSONArray pathArrayInner : pathList) {
|
|
@@ -358,7 +363,7 @@ public class WebSocketUtil {
|
|
|
sendItem.put("data", data);
|
|
|
sendArray.add(sendItem);
|
|
|
for (String id : idList.keySet()) {
|
|
|
- SendAndClear(id, sendArray);
|
|
|
+ SendBatch(id, sendArray);
|
|
|
}
|
|
|
}
|
|
|
boolean all_0 = false;
|
|
@@ -453,7 +458,7 @@ public class WebSocketUtil {
|
|
|
sendArray.add(sendItem);
|
|
|
}
|
|
|
if (sendArray.size() > 0) {
|
|
|
- SendAndClear(id, sendArray);
|
|
|
+ SendBatch(id, sendArray);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -505,7 +510,7 @@ public class WebSocketUtil {
|
|
|
sendArray.add(sendItem);
|
|
|
}
|
|
|
if (sendArray.size() > 0) {
|
|
|
- SendAndClear(id, sendArray);
|
|
|
+ SendBatch(id, sendArray);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|