| | |
| | | @Profile("dev-simulator") |
| | | public class DevelopmentSimulatorDiscoveryScheduler |
| | | { |
| | | private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(DevelopmentSimulatorDiscoveryScheduler.class); |
| | | private final DeviceAdapterRegistry registry; |
| | | private final DeviceDiscoveryPersistenceService persistence; |
| | | public DevelopmentSimulatorDiscoveryScheduler(DeviceAdapterRegistry registry, |
| | |
| | | public void discover() |
| | | { |
| | | if (!registry.contains(BtsDevelopmentSimulator.ADAPTER_CODE)) return; |
| | | persistence.discoverForReception(registry, new DiscoverySource(BtsDevelopmentSimulator.ADAPTER_CODE, null, |
| | | BtsDevelopmentSimulator.ADAPTER_NAME, BtsDevelopmentSimulator.POLL_INTERVAL_MS)); |
| | | try |
| | | { |
| | | persistence.discoverForReception(registry, new DiscoverySource(BtsDevelopmentSimulator.ADAPTER_CODE, null, |
| | | BtsDevelopmentSimulator.ADAPTER_NAME, BtsDevelopmentSimulator.POLL_INTERVAL_MS)); |
| | | } |
| | | catch (RuntimeException exception) |
| | | { |
| | | persistence.markUnavailable(BtsDevelopmentSimulator.ADAPTER_CODE); |
| | | log.warn("模拟设备观测失败,已清除过期实时值:{}", exception.getMessage()); |
| | | } |
| | | } |
| | | } |