GH-1347: Fix new Sonar issues
This commit is contained in:
@@ -425,22 +425,7 @@ public class DirectMessageListenerContainer extends AbstractMessageListenerConta
|
||||
super.doStart();
|
||||
final String[] queueNames = getQueueNames();
|
||||
checkMissingQueues(queueNames);
|
||||
if (isPossibleAuthenticationFailureFatal()) {
|
||||
Connection connection = null;
|
||||
try {
|
||||
getConnectionFactory().createConnection();
|
||||
}
|
||||
catch (AmqpAuthenticationException ex) {
|
||||
throw ex;
|
||||
}
|
||||
catch (Exception ex) { // NOSONAR
|
||||
}
|
||||
finally {
|
||||
if (connection != null) {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
checkConnect();
|
||||
long idleEventInterval = getIdleEventInterval();
|
||||
if (this.taskScheduler == null) {
|
||||
afterPropertiesSet();
|
||||
@@ -469,6 +454,26 @@ public class DirectMessageListenerContainer extends AbstractMessageListenerConta
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkConnect() {
|
||||
if (isPossibleAuthenticationFailureFatal()) {
|
||||
Connection connection = null;
|
||||
try {
|
||||
getConnectionFactory().createConnection();
|
||||
}
|
||||
catch (AmqpAuthenticationException ex) {
|
||||
this.logger.debug("Failed to authenticate", ex);
|
||||
throw ex;
|
||||
}
|
||||
catch (Exception ex) { // NOSONAR
|
||||
}
|
||||
finally {
|
||||
if (connection != null) {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startMonitor(long idleEventInterval, final Map<String, Queue> namesToQueues) {
|
||||
this.consumerMonitorTask = this.taskScheduler.scheduleAtFixedRate(() -> {
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
Reference in New Issue
Block a user