yeg
2026-08-26 e12439d1f4a94957d68cda653cb666702bc71040
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.ruoyi.system.service.impl;
 
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.ruoyi.system.service.IDeviceAdapterService;
 
/** 在单采集进程内恢复启用实例,并按各自周期执行只读发现。 */
@Component
public class DeviceAdapterRuntimeCoordinator
{
    private final IDeviceAdapterService service;
 
    public DeviceAdapterRuntimeCoordinator(IDeviceAdapterService service) { this.service = service; }
 
    @EventListener(ApplicationReadyEvent.class)
    public void restoreEnabledAdapters() { service.synchronizeEnabledAdapters(); }
 
    @Scheduled(fixedDelay = 1000)
    public void pollDueAdapters() { service.pollDueAdapters(); }
}