File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/com/rabbitmq/client/impl/recovery Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 5
5
import com .rabbitmq .client .BlockedListener ;
6
6
import com .rabbitmq .client .Channel ;
7
7
import com .rabbitmq .client .Connection ;
8
+ import com .rabbitmq .client .MissedHeartbeatException ;
8
9
import com .rabbitmq .client .Recoverable ;
9
10
import com .rabbitmq .client .RecoveryListener ;
10
11
import com .rabbitmq .client .ShutdownListener ;
@@ -378,7 +379,7 @@ private void addAutomaticRecoveryListener() {
378
379
ShutdownListener automaticRecoveryListener = new ShutdownListener () {
379
380
public void shutdownCompleted (ShutdownSignalException cause ) {
380
381
try {
381
- if (! cause . isInitiatedByApplication ( )) {
382
+ if (shouldTriggerConnectionRecovery ( cause )) {
382
383
c .beginAutomaticRecovery ();
383
384
}
384
385
} catch (Exception e ) {
@@ -394,6 +395,10 @@ public void shutdownCompleted(ShutdownSignalException cause) {
394
395
}
395
396
}
396
397
398
+ protected boolean shouldTriggerConnectionRecovery (ShutdownSignalException cause ) {
399
+ return !cause .isInitiatedByApplication () || (cause .getCause () instanceof MissedHeartbeatException );
400
+ }
401
+
397
402
/**
398
403
* Not part of the public API. Mean to be used by JVM RabbitMQ clients that build on
399
404
* top of the Java client and need to be notified when server-named queue name changes
You can’t perform that action at this time.
0 commit comments