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

[modbus] Avoid unnecessary IllegalArgumentException on dispose #8297

Merged
merged 2 commits into from
Aug 15, 2020

Commits on Aug 15, 2020

  1. [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>
    ssalonen committed Aug 15, 2020
    Configuration menu
    Copy the full SHA
    e913c5a View commit details
    Browse the repository at this point in the history
  2. [modbus] Document close method explicitly

    Signed-off-by: Sami Salonen <ssalonen@gmail.com>
    ssalonen committed Aug 15, 2020
    Configuration menu
    Copy the full SHA
    0216c1c View commit details
    Browse the repository at this point in the history