Skip to content
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

Add shutdownTrigger for registration engine #928

Closed
wants to merge 2 commits into from

Conversation

moznion
Copy link
Contributor

@moznion moznion commented Nov 12, 2020

Hello,

If the procedure inside of ClientInitiatedBootstrapTask, UpdateRegistrationTask, and/or RegistrationTask raises an unexpected exception, that exception caught by a catch clause and it logs that, but that task never works after caught and unfortunately the process still alive.
For example, if registerWithRetry() that is in RegistrationTask#run() raises a RuntimeException, that task never scheduled anymore.
This behavior makes a little bit hard to implement a robust LwM2M client. I think it would be better to exit when it falls an unexpected situation, as like as "let it crash".
So this patch introduces the shutdownTrigger mechanism to shut down the client when an unexpected exception occurred. shutdownTrigger is an implementation of Runnable, so the user can hand over the user-defined shutdown procedure to the registration engine.

If the procedure inside of `ClientInitiatedBootstrapTask`, `UpdateRegistrationTask`,
and/or `RegistrationTask` raises an unexpected exception, that exception caught by
a `catch` clause and it logs that, but that task never works after caught.
For example, if `registerWithRetry()` that is in `RegistrationTask#run()` raises a
`RuntimeException`, that task never scheduled anymore.
This behavior makes a little bit hard to implement a robust LwM2M client.
So this patch introduces the `shutdownTrigger` mechanism to shut down the client when
an unexpected exception occurred. `shutdownTrigger` is an implementation of `Runnable`,
so the user can hand over the user-defined shutdown procedure to the registration engine.

Signed-off-by: moznion <[email protected]>
@moznion
Copy link
Contributor Author

moznion commented Nov 19, 2020

I'm sorry, I had to make an issue at first instead of pull-request. I opened issue #933, so I close this pull-request for now.

@moznion moznion closed this Nov 19, 2020
@sbernard31
Copy link
Contributor

sbernard31 commented Nov 19, 2020

No problem, I just have no time to look at this when you open the PR, after I must confess that I forget you 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants