List of HTTP status codes

本文详细介绍了一系列HTTP状态码,包括常见的200 OK、404 Not Found等,并解释了它们的具体含义及应用场景。
// 每4秒检查一次 @Scheduled(fixedRate = 10000) public void databasePolling() { if (!startPollingDataFlag.get()) { log.info("等待加入下载任务..."); return; } log.info("开始轮询数据库: " + System.currentTimeMillis()); List<Integer> statusCodes = new ArrayList<>(); statusCodes.add(DownloadTaskStatusCode.DOWNLOAD_TASK_PENDING); statusCodes.add(DownloadTaskStatusCode.DOWNLOAD_TASK_DOWNLOADING); Map<Long, List<CaseCenterDownloadInfoDO>> collection = caseCenterDownloadInfoRepository.findByStatusCode( statusCodes); if(collection.isEmpty()){ startPollingDataFlag.set(false); } Set<Long> deviceIdSet = collection.keySet(); for (Long deviceId : deviceIdSet) { log.info("设备ID: " + deviceId); List<CaseCenterDownloadInfoDO> infoDOList=collection.get(deviceId); for (CaseCenterDownloadInfoDO infoDO : infoDOList) { short channelId = infoDO.getChannelId(); // Long deviceId = infoDO.getDeviceId(); // 获取分布式锁 if (cacheService.exist(channelId, deviceId)) { // 没有获取到锁,直接查询下一个设备 break; } else { // 设置分布式锁 cacheService.set(channelId, deviceId); // 若最早下载任务为等待中 if (infoDO.getStatusCode() == DownloadTaskStatusCode.DOWNLOAD_TASK_DOWNLOADING) { if (checkTaskAlive(infoDO)) { // 任务存活,释放锁,查询下一个设备 cacheService.delete(channelId, deviceId); break; } else { // 任务已失败,设置状态为任务失败,释放锁 caseCenterDownloadInfoRepository.updateById(infoDO.getId(),DownloadTaskStatusCode.DOWNLOAD_TASK_FAILED); cacheService.delete(channelId, deviceId); } // 若最早下载任务为等待中 } else if (infoDO.getStatusCode() == DownloadTaskStatusCode.DOWNLOAD_TASK_PENDING) { try{ executor.submit(new AddClipToCaseRunnable(infoDO, relayPushStreamService, customFileRepositoryService,caseCenterDownloadInfoRepository)); }catch (RejectedExecutionException e){ log.error("提交失败: 线程池饱和,异常信息 - " + e.getMessage()); cacheService.delete(channelId, deviceId); } // 更新数据库 caseCenterDownloadInfoRepository.updateById(infoDO.getId(),DownloadTaskStatusCode.DOWNLOAD_TASK_DOWNLOADING); cacheService.delete(channelId, deviceId); break; } } } } } 写出单元测试代码
10-31
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值