Add shutdownTrigger
for registration engine
#928
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
If the procedure inside of
ClientInitiatedBootstrapTask
,UpdateRegistrationTask
, and/orRegistrationTask
raises an unexpected exception, that exception caught by acatch
clause and it logs that, but that task never works after caught and unfortunately the process still alive.For example, if
registerWithRetry()
that is inRegistrationTask#run()
raises aRuntimeException
, 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 ofRunnable
, so the user can hand over the user-defined shutdown procedure to the registration engine.