Commit 935770e1a799e3e0f2ca8b2e6fa62ddc2d7b2af1

Authored by YevhenBondarenko
1 parent 4ac52b10

refactored

@@ -22,10 +22,7 @@ import org.eclipse.leshan.core.model.ResourceModel; @@ -22,10 +22,7 @@ import org.eclipse.leshan.core.model.ResourceModel;
22 import org.eclipse.leshan.core.node.LwM2mPath; 22 import org.eclipse.leshan.core.node.LwM2mPath;
23 import org.eclipse.leshan.server.registration.Registration; 23 import org.eclipse.leshan.server.registration.Registration;
24 import org.springframework.beans.factory.annotation.Autowired; 24 import org.springframework.beans.factory.annotation.Autowired;
25 -import org.springframework.boot.context.event.ApplicationReadyEvent;  
26 import org.springframework.context.annotation.Lazy; 25 import org.springframework.context.annotation.Lazy;
27 -import org.springframework.context.event.EventListener;  
28 -import org.springframework.core.annotation.Order;  
29 import org.springframework.stereotype.Service; 26 import org.springframework.stereotype.Service;
30 import org.thingsboard.server.common.data.DeviceProfile; 27 import org.thingsboard.server.common.data.DeviceProfile;
31 import org.thingsboard.server.common.data.device.data.PowerMode; 28 import org.thingsboard.server.common.data.device.data.PowerMode;
@@ -36,6 +33,7 @@ import org.thingsboard.server.common.transport.TransportDeviceProfileCache; @@ -36,6 +33,7 @@ import org.thingsboard.server.common.transport.TransportDeviceProfileCache;
36 import org.thingsboard.server.common.transport.TransportServiceCallback; 33 import org.thingsboard.server.common.transport.TransportServiceCallback;
37 import org.thingsboard.server.common.transport.auth.ValidateDeviceCredentialsResponse; 34 import org.thingsboard.server.common.transport.auth.ValidateDeviceCredentialsResponse;
38 import org.thingsboard.server.gen.transport.TransportProtos; 35 import org.thingsboard.server.gen.transport.TransportProtos;
  36 +import org.thingsboard.server.queue.util.AfterStartUp;
39 import org.thingsboard.server.queue.util.TbLwM2mTransportComponent; 37 import org.thingsboard.server.queue.util.TbLwM2mTransportComponent;
40 import org.thingsboard.server.transport.lwm2m.config.LwM2MTransportServerConfig; 38 import org.thingsboard.server.transport.lwm2m.config.LwM2MTransportServerConfig;
41 import org.thingsboard.server.transport.lwm2m.config.LwM2mVersion; 39 import org.thingsboard.server.transport.lwm2m.config.LwM2mVersion;
@@ -90,8 +88,7 @@ public class LwM2mClientContextImpl implements LwM2mClientContext { @@ -90,8 +88,7 @@ public class LwM2mClientContextImpl implements LwM2mClientContext {
90 private final Map<String, LwM2mClient> lwM2mClientsByRegistrationId = new ConcurrentHashMap<>(); 88 private final Map<String, LwM2mClient> lwM2mClientsByRegistrationId = new ConcurrentHashMap<>();
91 private final Map<UUID, Lwm2mDeviceProfileTransportConfiguration> profiles = new ConcurrentHashMap<>(); 89 private final Map<UUID, Lwm2mDeviceProfileTransportConfiguration> profiles = new ConcurrentHashMap<>();
92 90
93 - @EventListener(ApplicationReadyEvent.class)  
94 - @Order(Integer.MAX_VALUE - 1) 91 + @AfterStartUp(order = Integer.MAX_VALUE - 1)
95 public void init() { 92 public void init() {
96 String nodeId = context.getNodeId(); 93 String nodeId = context.getNodeId();
97 Set<LwM2mClient> fetchedClients = clientStore.getAll(); 94 Set<LwM2mClient> fetchedClients = clientStore.getAll();