-
Notifications
You must be signed in to change notification settings - Fork 781
Thing status changes from REMOVING to INITIALIZING #942
Comments
I did have a look at this one. The problem is that the ThingManager.thingRemoving sets the ThingStatus to REMOVING and notifies the handler about that. The handler then sets the ThingStatus to REMOVED (at least the BaseThingHandler) and the ThingManager then removes the thing. |
@J-N-K wrote:
Well, as I stated in the issue: "I would actually expect, that the handleRemoval() method is called on the handler in this situation." - which would mean that we would have to clearly document that this method can be called on an uninitialized handler as well. Alternatively, the framework might call initialize(), but must not set the status to INITIALIZING, when it is already REMOVING. The 3rd option is to change the specification to actually ALLOW the transition from REMOVING->INITIALIZING (imho not a good one). |
IMO neither the first nor the second option solve the problem. Things that need some sort of de-coupling probably need a handler that is ready to communicate with the thing, i.e. the thing needs to go all the way to ONLINE status before handleRemoval can properly do its job. |
The responsibility is with the handler. If it requires a connection, it can establish it, nobody says that this wouldn't be allowed. In 95% of all bindings, no action is required anyhow, so for them it wouldn't be relevant in any case. |
I would clearly prefer the second option:
As you already said: a handler with a working connection to the thing is required. Setting the thing status on the I any case, this burden should be put onto the framework, not the handler! I would really like to not make the handler implementation any more complicated than it really needs to be. |
One more thing that needs to be taken into account - it is possible while the handler waits for the end user to do some interaction with the device - the framework do be restarted (while the thing is still in REMOVING state). What would then be the behavior of the thing handler after the restart? |
I have observes a status transition that is not allowed according to the specification:
This situation happens if a Thing is in REMOVAL status and a thing handler is registered for it.
Easy to reproduce:
I would actually expect, that the handleRemoval() method is called on the handler in this situation.
The text was updated successfully, but these errors were encountered: