@@ -484,27 +484,7 @@ protected final Connection createBareConnection() {
484
484
try {
485
485
String connectionName = this .connectionNameStrategy .obtainNewConnectionName (this );
486
486
487
- com .rabbitmq .client .Connection rabbitConnection ;
488
- if (this .addresses != null ) {
489
- List <Address > addressesToConnect = this .addresses ;
490
- if (this .shuffleAddresses && addressesToConnect .size () > 1 ) {
491
- List <Address > list = new ArrayList <>(addressesToConnect );
492
- Collections .shuffle (list );
493
- addressesToConnect = list ;
494
- }
495
- if (this .logger .isInfoEnabled ()) {
496
- this .logger .info ("Attempting to connect to: " + addressesToConnect );
497
- }
498
- rabbitConnection = this .rabbitConnectionFactory .newConnection (this .executorService , addressesToConnect ,
499
- connectionName );
500
- }
501
- else {
502
- if (this .logger .isInfoEnabled ()) {
503
- this .logger .info ("Attempting to connect to: " + this .rabbitConnectionFactory .getHost ()
504
- + ":" + this .rabbitConnectionFactory .getPort ());
505
- }
506
- rabbitConnection = this .rabbitConnectionFactory .newConnection (this .executorService , connectionName );
507
- }
487
+ com .rabbitmq .client .Connection rabbitConnection = connect (connectionName );
508
488
509
489
Connection connection = new SimpleConnection (rabbitConnection , this .closeTimeout );
510
490
if (rabbitConnection instanceof AutorecoveringConnection ) {
@@ -535,7 +515,8 @@ public void handleRecovery(Recoverable recoverable) {
535
515
}
536
516
537
517
if (this .applicationEventPublisher != null ) {
538
- connection .addBlockedListener (new ConnectionBlockedListener (connection , this .applicationEventPublisher ));
518
+ connection .addBlockedListener (new ConnectionBlockedListener (connection ,
519
+ this .applicationEventPublisher ));
539
520
}
540
521
541
522
return connection ;
0 commit comments