Skip to content

Conversation

artembilan
Copy link
Member

Fixes #3627

The destroy(), and therefore stop() could be called from the MqttConnectionFailedEvent handling
in the same thread resetting the client property to null.

  • Check for this.client != null in the next block of the connectAndSubscribe() to avoid NPE
  • Check for isActive() in the scheduleReconnect() to be sure do not reconnect if channel adapter
    has been stopped already

Cherry-pick to 5.4.x

Fixes spring-projects#3627

The `destroy()`, and therefore `stop()` could be called from the `MqttConnectionFailedEvent` handling
in the same thread resetting the `client` property to `null`.

* Check for `this.client != null` in the next block of the `connectAndSubscribe()` to avoid NPE
* Check for `isActive()` in the `scheduleReconnect()` to be sure do not reconnect if channel adapter
has been stopped already

**Cherry-pick to `5.4.x`**
@garyrussell garyrussell merged commit 25ac230 into spring-projects:main Sep 9, 2021
@garyrussell
Copy link
Contributor

... and cherry-picked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nullpointerexception in spring-integration-mqtt adapter while reconnecting

2 participants