diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java index 40420d1be7..4250c158b8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java @@ -2,8 +2,6 @@ package com.epmet.commons.tools.utils; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.dto.form.DingTalkTextMsg; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; import com.google.common.collect.Lists; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.StringUtils; @@ -17,8 +15,6 @@ import javax.crypto.spec.SecretKeySpec; import java.io.IOException; import java.net.URLEncoder; import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; /** * desc: 发送消息工具类 @@ -43,15 +39,8 @@ public class DingdingMsgSender { */ private ArrayBlockingQueue msgQueue = new ArrayBlockingQueue<>(maxQueueSize); - private volatile boolean running = false; - private Cache limitCache = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).maximumSize(1000).build(); - - public DingdingMsgSender() { - - } - private void handleMsg() { DingTalkTextMsg msg = null; @@ -59,18 +48,7 @@ public class DingdingMsgSender { //阻塞取元素 msg = msgQueue.take(); if (msg != null) { - AtomicInteger limitCount = limitCache.getIfPresent(msg.getWebHook()); - if (limitCount == null) { - limitCount = new AtomicInteger(1); - limitCache.put(msg.getWebHook(), limitCount); - } - if (limitCount.intValue() > maxQueueSize) { - msgQueue.offer(msg); - Thread.sleep(1000); - } else { - sendPostByJSON(msg); - limitCount.addAndGet(1); - } + sendPostByJSON(msg); } else { Thread.sleep(1000); }