-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NotSerializableException when trying to serialize Registration object #647
Comments
To handle "server restart/failover" by persisting registrations in a file, you need to implements your own It could be a bit tricky but you could inspired yourself by looking at
About Java serialization is often considered as not well adapted for production use cases.
Anyway, if you feel that java serialization is adapted to your use case, I'm not really against trying to make it work in Leshan and to be honest currently the is not really clean to have Did you try to just make Identity implements |
I wasn't aware that you don't use Java serialization. So I'll either have to provide my own serialization/deserialization logic, or reuse RegistrationSerDes, witch I also wasn't aware of. |
I will probably make |
I created a PR to make |
If you're going to support Java serialization, you should also think about making org.eclipse.leshan.core.observation.Observation and org.eclipse.californium.core.observe.Observation serializable, because they're all needed for the implementation of CaliforniumRegistrationStore. |
@krisdx Good point ! I totally missed this part ... Making But making @boaks Do you have any opinion about that ? |
A PR for californium would be welcome. |
@krisdx I feel making We currently have a json serializer/deserializer, so maybe we should just back out making registration serializable again. What did you do finally ? You are using |
We've implemented the CaliforniumRegistrationStore by persisting only the Registrations in the DB. For the observations, we're just persisting info on what path an observation exists, and the actual org.eclipse.californium.core.observe.Observation objects are stored only at runtime, like in InMemoryRegistrationStore. When our server is restarted we re-initiate them (send new ObservationRequest for every existing path). We don't plan to serialize org.eclipse.californium.core.observe.Observation, nor to use Java serialization, so the decision is up to you. |
Using JSON serizalization should be enough. See old discussion #647
Using JSON serizalization should be enough. See old discussion #647
Using JSON serizalization should be enough. See old discussion #647
Hello, I'm doing some basic tests, trying to see ways to recover Registrations, after a server restart/failover, and when trying to write the Registration object to a file, I get:
java.io.NotSerializableException: org.eclipse.leshan.core.request.Identity
So can you tell me what I need to do, in order to Java serialize a Registration object?
The text was updated successfully, but these errors were encountered: