Skip to content

Commit

Permalink
Revert NPE check in the FailoverClientConnFactory
Browse files Browse the repository at this point in the history
* Add `synchronized` to `MqttPahoMessageDrivenChannelAdapter` setters to fix sync inconsistency
  • Loading branch information
artembilan committed Mar 3, 2020
1 parent fc4907d commit a795478
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,14 @@ protected TcpConnectionSupport obtainConnection() throws InterruptedException {
return failoverTcpConnection;
}

private void closeRefreshedIfNecessary(@Nullable FailoverTcpConnection sharedConnection, boolean refreshShared,
private void closeRefreshedIfNecessary(FailoverTcpConnection sharedConnection, boolean refreshShared,
FailoverTcpConnection failoverTcpConnection) {

this.creationTime = System.currentTimeMillis();
/*
* We may have simply wrapped the same connection in a new wrapper; don't close.
*/
if (refreshShared && this.closeOnRefresh
&& sharedConnection != null
&& !sharedConnection.delegate.equals(failoverTcpConnection.delegate)
&& sharedConnection.isOpen()) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public MqttPahoMessageDrivenChannelAdapter(String url, String clientId, String..
* @param completionTimeout The timeout.
* @since 4.1
*/
public void setCompletionTimeout(long completionTimeout) {
public synchronized void setCompletionTimeout(long completionTimeout) {
this.completionTimeout = completionTimeout;
}

Expand All @@ -138,7 +138,7 @@ public void setCompletionTimeout(long completionTimeout) {
* @param completionTimeout The timeout.
* @since 5.1.10
*/
public void setDisconnectCompletionTimeout(long completionTimeout) {
public synchronized void setDisconnectCompletionTimeout(long completionTimeout) {
this.disconnectCompletionTimeout = completionTimeout;
}

Expand Down

0 comments on commit a795478

Please sign in to comment.