@Component
public class AlarmReviewDataQueue {
private final LinkedBlockingQueue<AlgorithmAlarmReviewRecordDTO> queue = new LinkedBlockingQueue<>(5000);
public void offer(AlgorithmAlarmReviewRecordDTO record) {
queue.offer(record);
}
public AlgorithmAlarmReviewRecordDTO poll() {
return queue.poll();
}
}
Caused by: java.lang.NullPointerException: null
at com.qif.icms.ai.service.impl.AlarmReviewDataComsumerService.consume(AlarmReviewDataComsumerService.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
AlgorithmAlarmReviewRecordDTO algorithmAlarmReviewRecordDTO = alarmReviewDataQueue.poll();
List<PointInfo> pointInfo = algorithmAlarmReviewRecordDTO.getPointInfo();
有NPE的风险
//这个地方就要 判断 algorithmAlarmReviewRecordDTO 不为null