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

[velux] Improve shutdown exception handling #12356

Merged
merged 5 commits into from
Mar 19, 2022

Conversation

andrewfg
Copy link
Contributor

Potentially fixes #12327

This PR addresses the issues discussed in #10454 and #12327 in a further attempt to solve the KLF200 'zombie state' problem.

Two things have been improved..

  • Added an isDisposing flag so that the binding can shut down faster if it was already in a zombie state.
  • Refactored the code that reads messages from the KLF200 to handle InterruptedException , ExecutionException, and IOException more properly and completely.

Signed-off-by: Andrew Fiddian-Green software@whitebear.ch

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
@andrewfg andrewfg added enhancement An enhancement or new feature for an existing add-on additional testing preferred The change works for the pull request author. A test from someone else is preferred though. labels Feb 23, 2022
@andrewfg andrewfg requested a review from fwolter February 23, 2022 15:48
@andrewfg
Copy link
Contributor Author

Ping @gs4711 for comments if any..

@andrewfg andrewfg marked this pull request as draft February 23, 2022 15:50
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
@andrewfg andrewfg marked this pull request as ready for review February 27, 2022 16:05
@gs4711
Copy link
Contributor

gs4711 commented Feb 27, 2022

@andrewfg, being busy within the last days... therefore, now an answer after a delay of some days.

The changes look good to me. Just out of curiosity: how did you came to the value of MAX_WAIT_SECONDS ?

@andrewfg
Copy link
Contributor Author

how did you came to the value of MAX_WAIT_SECONDS

The OH maintainers request that a binding shutdown should try not to take longer than 15 seconds.

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
andrewfg added a commit to andrewfg/openhab-addons that referenced this pull request Feb 28, 2022
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
@andrewfg andrewfg removed the additional testing preferred The change works for the pull request author. A test from someone else is preferred though. label Feb 28, 2022
jlaur pushed a commit that referenced this pull request Mar 6, 2022
…12367)

* [openthermgateway] clean version of prior PR
* [openthermgateway] fix NoSuchMethod exception
* [openthermgateway] create thread according to OH guidelines
* [openthermgateway] fix annotation warning
* [openthermgateway] framework handles bridge status changes
* [openthermgateway] implement learnings from PR #12356
* [openthermgateway] add ReadMe chapter on migration v3.2 .. v3.3
* [openthermgateway] delete duplicate OpenThermGatewayBindingConstants class
* [openthermgateway] remove redundant else clause, remove npe warning
* [openthermgateway] log to debug rather than info; eliminate static import
* [openthermgateway] eliminate static import
* [openthermgateway] suppress unused argument warning
* [openthermgateway] delete xml definitions for no longer used 'otgw' Thing type

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
@andrewfg andrewfg requested a review from jlaur March 14, 2022 14:19
@fwolter fwolter merged commit e9cb9c3 into openhab:main Mar 19, 2022
@fwolter fwolter added this to the 3.3 milestone Mar 19, 2022
@andrewfg
Copy link
Contributor Author

@fwolter many thanks.

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/connection-to-velux-klf-200-is-lost-after-reboot/134354/3

NickWaterton pushed a commit to NickWaterton/openhab-addons that referenced this pull request Apr 27, 2022
…penhab#12367)

* [openthermgateway] clean version of prior PR
* [openthermgateway] fix NoSuchMethod exception
* [openthermgateway] create thread according to OH guidelines
* [openthermgateway] fix annotation warning
* [openthermgateway] framework handles bridge status changes
* [openthermgateway] implement learnings from PR openhab#12356
* [openthermgateway] add ReadMe chapter on migration v3.2 .. v3.3
* [openthermgateway] delete duplicate OpenThermGatewayBindingConstants class
* [openthermgateway] remove redundant else clause, remove npe warning
* [openthermgateway] log to debug rather than info; eliminate static import
* [openthermgateway] eliminate static import
* [openthermgateway] suppress unused argument warning
* [openthermgateway] delete xml definitions for no longer used 'otgw' Thing type

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
Signed-off-by: Nick Waterton <n.waterton@outlook.com>
NickWaterton pushed a commit to NickWaterton/openhab-addons that referenced this pull request Apr 27, 2022
* [velux] add isDisposing flag to accelerate shutdown

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] refactor Poller into a separate class

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] use new Poller class; fix startup, shutdown, and exception code

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] demote confusing log message

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] slightly more elegant interrupt flag set / check

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
Signed-off-by: Nick Waterton <n.waterton@outlook.com>
andan67 pushed a commit to andan67/openhab-addons that referenced this pull request Nov 6, 2022
…penhab#12367)

* [openthermgateway] clean version of prior PR
* [openthermgateway] fix NoSuchMethod exception
* [openthermgateway] create thread according to OH guidelines
* [openthermgateway] fix annotation warning
* [openthermgateway] framework handles bridge status changes
* [openthermgateway] implement learnings from PR openhab#12356
* [openthermgateway] add ReadMe chapter on migration v3.2 .. v3.3
* [openthermgateway] delete duplicate OpenThermGatewayBindingConstants class
* [openthermgateway] remove redundant else clause, remove npe warning
* [openthermgateway] log to debug rather than info; eliminate static import
* [openthermgateway] eliminate static import
* [openthermgateway] suppress unused argument warning
* [openthermgateway] delete xml definitions for no longer used 'otgw' Thing type

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
andan67 pushed a commit to andan67/openhab-addons that referenced this pull request Nov 6, 2022
* [velux] add isDisposing flag to accelerate shutdown

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] refactor Poller into a separate class

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] use new Poller class; fix startup, shutdown, and exception code

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] demote confusing log message

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] slightly more elegant interrupt flag set / check

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
andrasU pushed a commit to andrasU/openhab-addons that referenced this pull request Nov 12, 2022
…penhab#12367)

* [openthermgateway] clean version of prior PR
* [openthermgateway] fix NoSuchMethod exception
* [openthermgateway] create thread according to OH guidelines
* [openthermgateway] fix annotation warning
* [openthermgateway] framework handles bridge status changes
* [openthermgateway] implement learnings from PR openhab#12356
* [openthermgateway] add ReadMe chapter on migration v3.2 .. v3.3
* [openthermgateway] delete duplicate OpenThermGatewayBindingConstants class
* [openthermgateway] remove redundant else clause, remove npe warning
* [openthermgateway] log to debug rather than info; eliminate static import
* [openthermgateway] eliminate static import
* [openthermgateway] suppress unused argument warning
* [openthermgateway] delete xml definitions for no longer used 'otgw' Thing type

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
andrasU pushed a commit to andrasU/openhab-addons that referenced this pull request Nov 12, 2022
* [velux] add isDisposing flag to accelerate shutdown

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] refactor Poller into a separate class

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] use new Poller class; fix startup, shutdown, and exception code

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] demote confusing log message

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] slightly more elegant interrupt flag set / check

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
psmedley pushed a commit to psmedley/openhab-addons that referenced this pull request Feb 23, 2023
…penhab#12367)

* [openthermgateway] clean version of prior PR
* [openthermgateway] fix NoSuchMethod exception
* [openthermgateway] create thread according to OH guidelines
* [openthermgateway] fix annotation warning
* [openthermgateway] framework handles bridge status changes
* [openthermgateway] implement learnings from PR openhab#12356
* [openthermgateway] add ReadMe chapter on migration v3.2 .. v3.3
* [openthermgateway] delete duplicate OpenThermGatewayBindingConstants class
* [openthermgateway] remove redundant else clause, remove npe warning
* [openthermgateway] log to debug rather than info; eliminate static import
* [openthermgateway] eliminate static import
* [openthermgateway] suppress unused argument warning
* [openthermgateway] delete xml definitions for no longer used 'otgw' Thing type

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
psmedley pushed a commit to psmedley/openhab-addons that referenced this pull request Feb 23, 2023
* [velux] add isDisposing flag to accelerate shutdown

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] refactor Poller into a separate class

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] use new Poller class; fix startup, shutdown, and exception code

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] demote confusing log message

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>

* [velux] slightly more elegant interrupt flag set / check

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
@andrewfg andrewfg deleted the velux-issue12327 branch August 25, 2024 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[velux] catching InterruptedException or not?
4 participants