使用线程安全的map存储订阅信息

修改点播消息内容,提升兼容性
This commit is contained in:
648540858
2020-12-14 16:51:29 +08:00
parent 1a827a4dd4
commit 3d2aeb890b
5 changed files with 12 additions and 48 deletions

View File

@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.util.ConcurrentReferenceHashMap;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@@ -20,6 +21,7 @@ import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @Description:针对 ZLMediaServer的hook事件订阅
@@ -50,7 +52,7 @@ public class ZLMHttpHookSubscribe {
void response(JSONObject response);
}
private Map<HookType, Map<JSONObject, ZLMHttpHookSubscribe.Event>> allSubscribes = new HashMap<>();
private Map<HookType, Map<JSONObject, ZLMHttpHookSubscribe.Event>> allSubscribes = new ConcurrentHashMap<>();
public void addSubscribe(HookType type, JSONObject hookResponse, ZLMHttpHookSubscribe.Event event) {
Map<JSONObject, Event> eventMap = allSubscribes.get(type);