Browse Source

Fix concurrent modification issue during warn logging

pull/6437/head
Volodymyr Babak 5 years ago
parent
commit
604f5b8d25
  1. 10
      application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java

10
application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java

@ -399,11 +399,15 @@ public final class EdgeGrpcSession implements Closeable {
Runnable sendDownlinkMsgsTask = () -> {
try {
if (isConnected() && sessionState.getPendingMsgsMap().values().size() > 0) {
List<DownlinkMsg> copy = null;
if (!firstRun) {
log.warn("[{}] Failed to deliver the batch: {}", this.sessionId, sessionState.getPendingMsgsMap().values());
copy = new ArrayList<>(sessionState.getPendingMsgsMap().values());
log.warn("[{}] Failed to deliver the batch: {}", this.sessionId, copy);
}
log.trace("[{}] [{}] downlink msg(s) are going to be send.", this.sessionId, sessionState.getPendingMsgsMap().values().size());
List<DownlinkMsg> copy = new ArrayList<>(sessionState.getPendingMsgsMap().values());
if (copy == null) {
copy = new ArrayList<>(sessionState.getPendingMsgsMap().values());
}
log.trace("[{}] [{}] downlink msg(s) are going to be send.", this.sessionId, copy.size());
for (DownlinkMsg downlinkMsg : copy) {
sendDownlinkMsg(ResponseMsg.newBuilder()
.setDownlinkMsg(downlinkMsg)

Loading…
Cancel
Save