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