Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[modbus] Avoid unnecessary IllegalArgumentException on dispose (openh…
…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 <ssalonen@gmail.com> Signed-off-by: Daan Meijer <daan@studioseptember.nl>
- Loading branch information