|
@@ -308,41 +308,39 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
|
|
|
Map<String, Object> resultMap = null;
|
|
|
boolean lockStreamIds = false;
|
|
|
- try {
|
|
|
- for (int i = 0; i < SystemConstant.MAX_TENCENT_VIDEO_STREAM_ID_COUNT; i++) {
|
|
|
- lockStreamIds = redisUtil.lock(SystemConstant.REDIS_LOCK_TENCENT_VIDEO_STREAM_ID_PREFIX + streamIds.toString(),
|
|
|
- SystemConstant.REDIS_LOCK_TENCENT_VIDEO_STREAM_ID_TIME_OUT);
|
|
|
- if (lockStreamIds) {
|
|
|
- try {
|
|
|
- resultMap = tencentYunUtil.tencentVodSdk(tencentYunUtil.getTencentYunDomain().getSecretId(),
|
|
|
- tencentYunUtil.getTencentYunDomain().getSecretKey(),
|
|
|
- tencentYunUtil.getTencentYunDomain().getQueryUrl(),
|
|
|
- tencentYunUtil.getTencentYunDomain().getVodAppId(),
|
|
|
- streamIds);
|
|
|
- break;
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("请求出错", e);
|
|
|
- if (i == SystemConstant.MAX_TENCENT_VIDEO_STREAM_ID_COUNT - 1) {
|
|
|
- tgErrorService.saveExamTgError(recordId, "execMqTencentVideoLogic");
|
|
|
- } else {
|
|
|
- try {
|
|
|
- Thread.sleep(3000);
|
|
|
- } catch (InterruptedException ex) {
|
|
|
- ex.printStackTrace();
|
|
|
- }
|
|
|
+ for (int i = 0; i < SystemConstant.MAX_TENCENT_VIDEO_STREAM_ID_COUNT; i++) {
|
|
|
+ lockStreamIds = redisUtil.lock(SystemConstant.REDIS_LOCK_TENCENT_VIDEO_STREAM_ID_PREFIX + streamIds.toString(),
|
|
|
+ SystemConstant.REDIS_LOCK_TENCENT_VIDEO_STREAM_ID_TIME_OUT);
|
|
|
+ if (lockStreamIds) {
|
|
|
+ try {
|
|
|
+ resultMap = tencentYunUtil.tencentVodSdk(tencentYunUtil.getTencentYunDomain().getSecretId(),
|
|
|
+ tencentYunUtil.getTencentYunDomain().getSecretKey(),
|
|
|
+ tencentYunUtil.getTencentYunDomain().getQueryUrl(),
|
|
|
+ tencentYunUtil.getTencentYunDomain().getVodAppId(),
|
|
|
+ streamIds);
|
|
|
+ break;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("请求出错", e);
|
|
|
+ if (i == SystemConstant.MAX_TENCENT_VIDEO_STREAM_ID_COUNT - 1) {
|
|
|
+ tgErrorService.saveExamTgError(recordId, "execMqTencentVideoLogic");
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ Thread.sleep(3000);
|
|
|
+ } catch (InterruptedException ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- try {
|
|
|
- Thread.sleep(1000);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ if (Objects.nonNull(streamIds)) {
|
|
|
+ redisUtil.releaseLock(SystemConstant.REDIS_LOCK_TENCENT_VIDEO_STREAM_ID_PREFIX + streamIds.toString());
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- } finally {
|
|
|
- if (Objects.nonNull(streamIds)) {
|
|
|
- redisUtil.releaseLock(SystemConstant.REDIS_LOCK_TENCENT_VIDEO_STREAM_ID_PREFIX + streamIds.toString());
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ Thread.sleep(3000);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|