-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[modbus] Avoid unnecessary IllegalArgumentException on dispose #8297
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If communication interface is closed, you cannot naturally interact with the device anymore. IllegalArgumentException is raised with all methods that would need to interact with the device. In this commit, close() and unregisterRegularPoll methods are not raising the exception anymore since they are essentially no-ops with closed communication interface. After all, close automatically unregisters all registered regular polls. Thus, it should be considered harmless to call these methods again on a closed instance, making them mostly idempotent. This change was motivated by seeing the IllegalStateException in the wild, possibly triggered by certain dispose/initialize steps of things: https://community.openhab.org/t/snip/102809/43 Signed-off-by: Sami Salonen <[email protected]>
Signed-off-by: Sami Salonen <[email protected]>
Travis tests were successfulHey @ssalonen, |
fwolter
approved these changes
Aug 15, 2020
andrewfg
pushed a commit
to andrewfg/openhab-addons
that referenced
this pull request
Aug 31, 2020
…ab#8297) [modbus] Do not raise exception on no-op operation of comms. interface If communication interface is closed, you cannot naturally interact with the device anymore. IllegalArgumentException is raised with all methods that would need to interact with the device. In this commit, close() and unregisterRegularPoll methods are not raising the exception anymore since they are essentially no-ops with closed communication interface. After all, close automatically unregisters all registered regular polls. Thus, it should be considered harmless to call these methods again on a closed instance, making them mostly idempotent. This change was motivated by seeing the IllegalStateException in the wild, possibly triggered by certain dispose/initialize steps of things: https://community.openhab.org/t/snip/102809/43 Signed-off-by: Sami Salonen <[email protected]>
andrewfg
pushed a commit
to andrewfg/openhab-addons
that referenced
this pull request
Aug 31, 2020
…ab#8297) [modbus] Do not raise exception on no-op operation of comms. interface If communication interface is closed, you cannot naturally interact with the device anymore. IllegalArgumentException is raised with all methods that would need to interact with the device. In this commit, close() and unregisterRegularPoll methods are not raising the exception anymore since they are essentially no-ops with closed communication interface. After all, close automatically unregisters all registered regular polls. Thus, it should be considered harmless to call these methods again on a closed instance, making them mostly idempotent. This change was motivated by seeing the IllegalStateException in the wild, possibly triggered by certain dispose/initialize steps of things: https://community.openhab.org/t/snip/102809/43 Signed-off-by: Sami Salonen <[email protected]>
andrewfg
pushed a commit
to andrewfg/openhab-addons
that referenced
this pull request
Aug 31, 2020
…ab#8297) [modbus] Do not raise exception on no-op operation of comms. interface If communication interface is closed, you cannot naturally interact with the device anymore. IllegalArgumentException is raised with all methods that would need to interact with the device. In this commit, close() and unregisterRegularPoll methods are not raising the exception anymore since they are essentially no-ops with closed communication interface. After all, close automatically unregisters all registered regular polls. Thus, it should be considered harmless to call these methods again on a closed instance, making them mostly idempotent. This change was motivated by seeing the IllegalStateException in the wild, possibly triggered by certain dispose/initialize steps of things: https://community.openhab.org/t/snip/102809/43 Signed-off-by: Sami Salonen <[email protected]>
andrewfg
pushed a commit
to andrewfg/openhab-addons
that referenced
this pull request
Aug 31, 2020
…ab#8297) [modbus] Do not raise exception on no-op operation of comms. interface If communication interface is closed, you cannot naturally interact with the device anymore. IllegalArgumentException is raised with all methods that would need to interact with the device. In this commit, close() and unregisterRegularPoll methods are not raising the exception anymore since they are essentially no-ops with closed communication interface. After all, close automatically unregisters all registered regular polls. Thus, it should be considered harmless to call these methods again on a closed instance, making them mostly idempotent. This change was motivated by seeing the IllegalStateException in the wild, possibly triggered by certain dispose/initialize steps of things: https://community.openhab.org/t/snip/102809/43 Signed-off-by: Sami Salonen <[email protected]>
DaanMeijer
pushed a commit
to DaanMeijer/openhab-addons
that referenced
this pull request
Sep 1, 2020
…ab#8297) [modbus] Do not raise exception on no-op operation of comms. interface If communication interface is closed, you cannot naturally interact with the device anymore. IllegalArgumentException is raised with all methods that would need to interact with the device. In this commit, close() and unregisterRegularPoll methods are not raising the exception anymore since they are essentially no-ops with closed communication interface. After all, close automatically unregisters all registered regular polls. Thus, it should be considered harmless to call these methods again on a closed instance, making them mostly idempotent. This change was motivated by seeing the IllegalStateException in the wild, possibly triggered by certain dispose/initialize steps of things: https://community.openhab.org/t/snip/102809/43 Signed-off-by: Sami Salonen <[email protected]> Signed-off-by: Daan Meijer <[email protected]>
CSchlipp
pushed a commit
to CSchlipp/openhab-addons
that referenced
this pull request
Sep 12, 2020
…ab#8297) [modbus] Do not raise exception on no-op operation of comms. interface If communication interface is closed, you cannot naturally interact with the device anymore. IllegalArgumentException is raised with all methods that would need to interact with the device. In this commit, close() and unregisterRegularPoll methods are not raising the exception anymore since they are essentially no-ops with closed communication interface. After all, close automatically unregisters all registered regular polls. Thus, it should be considered harmless to call these methods again on a closed instance, making them mostly idempotent. This change was motivated by seeing the IllegalStateException in the wild, possibly triggered by certain dispose/initialize steps of things: https://community.openhab.org/t/snip/102809/43 Signed-off-by: Sami Salonen <[email protected]>
markus7017
pushed a commit
to markus7017/openhab-addons
that referenced
this pull request
Sep 19, 2020
…ab#8297) [modbus] Do not raise exception on no-op operation of comms. interface If communication interface is closed, you cannot naturally interact with the device anymore. IllegalArgumentException is raised with all methods that would need to interact with the device. In this commit, close() and unregisterRegularPoll methods are not raising the exception anymore since they are essentially no-ops with closed communication interface. After all, close automatically unregisters all registered regular polls. Thus, it should be considered harmless to call these methods again on a closed instance, making them mostly idempotent. This change was motivated by seeing the IllegalStateException in the wild, possibly triggered by certain dispose/initialize steps of things: https://community.openhab.org/t/snip/102809/43 Signed-off-by: Sami Salonen <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If communication interface is closed, you cannot naturally interact with the device anymore.
IllegalArgumentException
is raised with all methods that would need to interact with the device.In this commit,
close
andunregisterRegularPoll
methods are not raising the exception anymore since they are essentially no-ops with closed communication interface. After all, close automatically unregisters all registered regular polls. Thus, it should be considered harmless to call these methods again on a closed instance, making them mostly idempotent.This change was motivated by seeing the
IllegalStateException
in the wild (when disposing modbuspoller
thing), possibly triggered by certain dispose/initialize/reload of things: https://community.openhab.org/t/snip/102809/43