package cn.amq.safetyhat;

import java.util.ArrayList;
import java.util.List;

import cn.amq.peas.SafetyHatAlarmPeas;

/**
 * 安全帽告警缓存并推送至前端
 * @author Lenovo
 *
 */
public class SafetyHatAlarmDateService {

	Object mutex = new Object();
	
	private List<SafetyHatAlarmPeas> safetyHatAlarmDateList = new ArrayList<SafetyHatAlarmPeas>();

	public List<SafetyHatAlarmPeas> getSafetyHatAlarmDataList() {
		synchronized (mutex) {
			List<SafetyHatAlarmPeas> tempList = new ArrayList<SafetyHatAlarmPeas>();
			tempList = safetyHatAlarmDateList;
			safetyHatAlarmDateList = new ArrayList<SafetyHatAlarmPeas>();
			return tempList;
		}
	}

	public void setSafetyHatAlarmDataList(List<SafetyHatAlarmPeas> ls) {
		synchronized (mutex) {
			if (safetyHatAlarmDateList != null) {
				safetyHatAlarmDateList.addAll(ls);
			}
		}
	}
}
