| | |
| | | return discoverNow(registry, source); |
| | | } |
| | | |
| | | /** 调度器观测;暂停或停止测试且没有其他接收测试时,不再向该适配器请求实时数据。 */ |
| | | /** 执行设备发现;是否请求实时快照由接收中的通道集合单独决定。 */ |
| | | public AdapterDiscoveryResult discoverForReception(DeviceAdapterRegistry registry, DiscoverySource source) |
| | | { |
| | | if (!shouldPollReception(source.adapterCode())) |
| | | return new AdapterDiscoveryResult(0, 0, Instant.now()); |
| | | return discoverNow(registry, source); |
| | | } |
| | | |
| | | /** 判断适配器是否仍需为活动测试发起实时请求。 */ |
| | | /** 判断适配器是否存在需要实时请求的接收中测试。 */ |
| | | public boolean shouldPollReception(String adapterCode) |
| | | { |
| | | return testMapper == null || testMapper.hasReceivingTestForAdapter(adapterCode) > 0 |
| | | || testMapper.hasPausedOrEndedTestForAdapter(adapterCode) == 0; |
| | | return testMapper == null || testMapper.hasReceivingTestForAdapter(adapterCode) > 0; |
| | | } |
| | | |
| | | private AdapterDiscoveryResult discoverNow(DeviceAdapterRegistry registry, DiscoverySource source) |