|  |  |  | 
|---|
|  |  |  | boolean isEmpty = taskQueue.isEmpty(); | 
|---|
|  |  |  | taskQueue.offer(message); | 
|---|
|  |  |  | if (isEmpty) { | 
|---|
|  |  |  | logger.info("[线程池信息]活动线程数:{}, 最大线程数: {}", taskExecutor.getActiveCount(), taskExecutor.getMaxPoolSize()); | 
|---|
|  |  |  | //            logger.info("[线程池信息]活动线程数:{}, 最大线程数: {}", taskExecutor.getActiveCount(), taskExecutor.getMaxPoolSize()); | 
|---|
|  |  |  | taskExecutor.execute(() -> { | 
|---|
|  |  |  | while (!taskQueue.isEmpty()) { | 
|---|
|  |  |  | Message msg = taskQueue.poll(); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (parentPlatforms.size() > 0) { | 
|---|
|  |  |  | for (ParentPlatform parentPlatform : parentPlatforms) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | deviceAlarm.setChannelId(parentPlatform.getDeviceGBId()); | 
|---|
|  |  |  | commanderForPlatform.sendAlarmMessage(parentPlatform, deviceAlarm); | 
|---|
|  |  |  | } catch (SipException | InvalidArgumentException | ParseException e) { | 
|---|
|  |  |  | logger.error("[命令发送失败] 国标级联 发送报警: {}", e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (parentPlatforms.size() > 0) { | 
|---|
|  |  |  | for (ParentPlatform parentPlatform : parentPlatforms) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | deviceAlarm.setChannelId(parentPlatform.getDeviceGBId()); | 
|---|
|  |  |  | commanderForPlatform.sendAlarmMessage(parentPlatform, deviceAlarm); | 
|---|
|  |  |  | } catch (SipException | InvalidArgumentException | ParseException e) { | 
|---|
|  |  |  | logger.error("[命令发送失败] 国标级联 发送报警: {}", e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (devices.size() > 0) { | 
|---|
|  |  |  | for (Device device : devices) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | deviceAlarm.setChannelId(device.getDeviceId()); | 
|---|
|  |  |  | commander.sendAlarmMessage(device, deviceAlarm); | 
|---|
|  |  |  | } catch (InvalidArgumentException | SipException | ParseException e) { | 
|---|
|  |  |  | logger.error("[命令发送失败] 发送报警: {}", e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e) { | 
|---|
|  |  |  | logger.error("未处理的异常 ", e); | 
|---|
|  |  |  | logger.warn("[REDIS的ALARM通知] 发现未处理的异常, {}",e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|