mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-25 13:35:15 +08:00
同步获取响应数据
This commit is contained in:
@@ -10,6 +10,7 @@ import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.*;
|
||||
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
|
||||
import com.jsowell.pile.domain.ykcCommond.*;
|
||||
import com.jsowell.pile.rpc.RpcUtil;
|
||||
import com.jsowell.pile.rpc.SyncPromise;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||
@@ -41,7 +42,6 @@ import java.util.concurrent.TimeoutException;
|
||||
@Slf4j
|
||||
@Service
|
||||
public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
private final static Map<String, SyncPromise> syncPromiseMap = new ConcurrentHashMap<>();
|
||||
|
||||
@Autowired
|
||||
private PileBillingTemplateService pileBillingTemplateService;
|
||||
@@ -162,8 +162,8 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
|
||||
// 消息id = channelId + 帧类型(例如: "0x34")
|
||||
String msgId = ctx.channel().id().toString() + "_" + YKCUtils.frameType2Str(((YKCFrameTypeCode) frameTypeCode).getBytes());
|
||||
|
||||
syncPromiseMap.put(msgId, syncPromise);
|
||||
log.info("同步获取响应数据-发送消息, msgId:{}", msgId);
|
||||
RpcUtil.getSyncPromiseMap().put(msgId, syncPromise);
|
||||
|
||||
// 发送消息,此处如果发送玩消息并且在get之前返回了结果,下一行的get将不会进入阻塞,也可以顺利拿到结果
|
||||
/*
|
||||
@@ -223,7 +223,7 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
}
|
||||
|
||||
// 移除容器
|
||||
syncPromiseMap.remove(msgId);
|
||||
RpcUtil.getSyncPromiseMap().remove(msgId);
|
||||
|
||||
return rpcResponse;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user