Registration is not Serializable
This commit is contained in:
parent
847630259c
commit
e3af72eb88
@ -20,6 +20,7 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.eclipse.leshan.core.link.LinkParamValue;
|
||||||
import org.eclipse.leshan.core.model.ObjectModel;
|
import org.eclipse.leshan.core.model.ObjectModel;
|
||||||
import org.eclipse.leshan.core.model.ResourceModel;
|
import org.eclipse.leshan.core.model.ResourceModel;
|
||||||
import org.eclipse.leshan.core.node.LwM2mMultipleResource;
|
import org.eclipse.leshan.core.node.LwM2mMultipleResource;
|
||||||
@ -108,7 +109,7 @@ public class LwM2mClient implements Serializable {
|
|||||||
@Getter
|
@Getter
|
||||||
private Long edrxCycle;
|
private Long edrxCycle;
|
||||||
@Getter
|
@Getter
|
||||||
private Registration registration;
|
private transient Registration registration;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private boolean asleep;
|
private boolean asleep;
|
||||||
@ -121,9 +122,9 @@ public class LwM2mClient implements Serializable {
|
|||||||
private boolean firstEdrxDownlink = true;
|
private boolean firstEdrxDownlink = true;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private Set<ContentFormat> clientSupportContentFormats;
|
private transient Set<ContentFormat> clientSupportContentFormats;
|
||||||
@Getter
|
@Getter
|
||||||
private ContentFormat defaultContentFormat;
|
private transient ContentFormat defaultContentFormat;
|
||||||
@Getter
|
@Getter
|
||||||
private final AtomicInteger retryAttempts;
|
private final AtomicInteger retryAttempts;
|
||||||
|
|
||||||
@ -430,9 +431,9 @@ public class LwM2mClient implements Serializable {
|
|||||||
static private Set<ContentFormat> clientSupportContentFormat(Registration registration) {
|
static private Set<ContentFormat> clientSupportContentFormat(Registration registration) {
|
||||||
Set<ContentFormat> contentFormats = new HashSet<>();
|
Set<ContentFormat> contentFormats = new HashSet<>();
|
||||||
contentFormats.add(ContentFormat.DEFAULT);
|
contentFormats.add(ContentFormat.DEFAULT);
|
||||||
String code = Arrays.stream(registration.getObjectLinks()).filter(link -> link.getUriReference().equals("/")).findFirst().get().getLinkParams().get("ct").getUnquoted();
|
LinkParamValue ct = Arrays.stream(registration.getObjectLinks()).filter(link -> link.getUriReference().equals("/")).findFirst().get().getLinkParams().get("ct");
|
||||||
if (code != null) {
|
if (ct != null) {
|
||||||
Set<ContentFormat> codes = Stream.of(code.replaceAll("\"", "").split(" ", -1))
|
Set<ContentFormat> codes = Stream.of(ct.getUnquoted().replaceAll("\"", "").split(" ", -1))
|
||||||
.map(String::trim)
|
.map(String::trim)
|
||||||
.map(Integer::parseInt)
|
.map(Integer::parseInt)
|
||||||
.map(ContentFormat::fromCode)
|
.map(ContentFormat::fromCode)
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.eclipse.leshan.core.SecurityMode;
|
import org.eclipse.leshan.core.SecurityMode;
|
||||||
import org.eclipse.leshan.core.node.LwM2mPath;
|
import org.eclipse.leshan.core.node.LwM2mPath;
|
||||||
import org.eclipse.leshan.server.registration.Registration;
|
import org.eclipse.leshan.server.registration.Registration;
|
||||||
|
import org.eclipse.leshan.server.registration.RegistrationStore;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -72,6 +73,7 @@ public class LwM2mClientContextImpl implements LwM2mClientContext {
|
|||||||
private final LwM2MSessionManager sessionManager;
|
private final LwM2MSessionManager sessionManager;
|
||||||
private final TransportDeviceProfileCache deviceProfileCache;
|
private final TransportDeviceProfileCache deviceProfileCache;
|
||||||
private final LwM2MModelConfigService modelConfigService;
|
private final LwM2MModelConfigService modelConfigService;
|
||||||
|
private final RegistrationStore registrationStore;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
||||||
@ -118,8 +120,11 @@ public class LwM2mClientContextImpl implements LwM2mClientContext {
|
|||||||
|
|
||||||
private void updateFetchedClient(String nodeId, LwM2mClient client) {
|
private void updateFetchedClient(String nodeId, LwM2mClient client) {
|
||||||
boolean updated = false;
|
boolean updated = false;
|
||||||
if (client.getRegistration() != null) {
|
Registration registration = registrationStore.getRegistrationByEndpoint(client.getEndpoint());
|
||||||
lwM2mClientsByRegistrationId.put(client.getRegistration().getId(), client);
|
|
||||||
|
if (registration != null) {
|
||||||
|
client.setRegistration(registration);
|
||||||
|
lwM2mClientsByRegistrationId.put(registration.getId(), client);
|
||||||
}
|
}
|
||||||
if (client.getSession() != null) {
|
if (client.getSession() != null) {
|
||||||
client.refreshSessionId(nodeId);
|
client.refreshSessionId(nodeId);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user