/** * 单个cd信息下发 * * @param cdType */ public void snapCdQueueInfo(CdType cdType) { CdQueueInfo cdQueueInfo = new CdQueueInfo(); cdQueueInfo.setCdType(cdType.getIndex()); CdInfo cdInfo = getCdInfo(cdType); cdQueueInfo.setTimeDiff((int) getDiffTime(getCdInfo(cdType).getEndTime())); GCCdQueueInfo gcMsg = new GCCdQueueInfo(); gcMsg.setCd(cdQueueInfo); human.sendMessage(gcMsg); cdInfoMap.put(cdType, cdInfo); // 同步缓存 cdInfoCaches.addUpdate(cdType, cdInfo); }
/** 下发cd信息 */ public void snapCdQueueInfos() { List<CdQueueInfo> cdQueueInfos = new ArrayList<CdQueueInfo>(); for (CdType cdType : cdInfoMap.keySet()) { CdQueueInfo cdQueueInfo = new CdQueueInfo(); cdQueueInfo.setCdType(cdType.getIndex()); cdQueueInfo.setTimeDiff((int) getDiffTime(getCdInfo(cdType).getEndTime())); cdQueueInfos.add(cdQueueInfo); } GCCdQueueInfos gcMsg = new GCCdQueueInfos(); gcMsg.setCds(cdQueueInfos.toArray(new CdQueueInfo[0])); human.sendMessage(gcMsg); }