| | |
| | | |
| | | import com.zy.core.model.protocol.RgvProtocol; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static void updateRgvStatus(RgvProtocol status) { |
| | | try { |
| | | if (status.getRgvNo()!=1 && status.getRgvNo() != 2){ |
| | | return; |
| | | } |
| | | cache.put(status.getRgvNo(), status); |
| | | } finally { |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取所有设备状态 |
| | | */ |
| | | public static void removeAll() { |
| | | try { |
| | | ConcurrentHashMap<Integer, RgvProtocol> integerRgvProtocolConcurrentHashMap = new ConcurrentHashMap<>(cache); |
| | | if (integerRgvProtocolConcurrentHashMap.values().size()>2){ |
| | | for (RgvProtocol rgvProtocol : integerRgvProtocolConcurrentHashMap.values()){ |
| | | cache.remove(rgvProtocol.getRgvNo()); |
| | | } |
| | | } |
| | | } finally { |
| | | } |
| | | } |
| | | |
| | | } |