3535 */
3636public class DefaultRetryHandler implements RetryHandler {
3737
38- private final BiPredicate <RecordedQueue , Exception > queueRecoveryRetryCondition ;
39- private final BiPredicate <RecordedExchange , Exception > exchangeRecoveryRetryCondition ;
40- private final BiPredicate <RecordedBinding , Exception > bindingRecoveryRetryCondition ;
41- private final BiPredicate <RecordedConsumer , Exception > consumerRecoveryRetryCondition ;
38+ private final BiPredicate <? super RecordedQueue , Exception > queueRecoveryRetryCondition ;
39+ private final BiPredicate <? super RecordedExchange , Exception > exchangeRecoveryRetryCondition ;
40+ private final BiPredicate <? super RecordedBinding , Exception > bindingRecoveryRetryCondition ;
41+ private final BiPredicate <? super RecordedConsumer , Exception > consumerRecoveryRetryCondition ;
4242
4343 private final RetryOperation <?> queueRecoveryRetryOperation ;
4444 private final RetryOperation <?> exchangeRecoveryRetryOperation ;
@@ -49,10 +49,10 @@ public class DefaultRetryHandler implements RetryHandler {
4949
5050 private final BackoffPolicy backoffPolicy ;
5151
52- public DefaultRetryHandler (BiPredicate <RecordedQueue , Exception > queueRecoveryRetryCondition ,
53- BiPredicate <RecordedExchange , Exception > exchangeRecoveryRetryCondition ,
54- BiPredicate <RecordedBinding , Exception > bindingRecoveryRetryCondition ,
55- BiPredicate <RecordedConsumer , Exception > consumerRecoveryRetryCondition ,
52+ public DefaultRetryHandler (BiPredicate <? super RecordedQueue , Exception > queueRecoveryRetryCondition ,
53+ BiPredicate <? super RecordedExchange , Exception > exchangeRecoveryRetryCondition ,
54+ BiPredicate <? super RecordedBinding , Exception > bindingRecoveryRetryCondition ,
55+ BiPredicate <? super RecordedConsumer , Exception > consumerRecoveryRetryCondition ,
5656 RetryOperation <?> queueRecoveryRetryOperation ,
5757 RetryOperation <?> exchangeRecoveryRetryOperation ,
5858 RetryOperation <?> bindingRecoveryRetryOperation ,
@@ -72,27 +72,31 @@ public DefaultRetryHandler(BiPredicate<RecordedQueue, Exception> queueRecoveryRe
7272 this .retryAttempts = retryAttempts ;
7373 }
7474
75+ @ SuppressWarnings ("unchecked" )
7576 @ Override
7677 public RetryResult retryQueueRecovery (RetryContext context ) throws Exception {
77- return doRetry (queueRecoveryRetryCondition , queueRecoveryRetryOperation , context .queue (), context );
78+ return doRetry (( BiPredicate < RecordedEntity , Exception >) queueRecoveryRetryCondition , queueRecoveryRetryOperation , context .queue (), context );
7879 }
7980
81+ @ SuppressWarnings ("unchecked" )
8082 @ Override
8183 public RetryResult retryExchangeRecovery (RetryContext context ) throws Exception {
82- return doRetry (exchangeRecoveryRetryCondition , exchangeRecoveryRetryOperation , context .exchange (), context );
84+ return doRetry (( BiPredicate < RecordedEntity , Exception >) exchangeRecoveryRetryCondition , exchangeRecoveryRetryOperation , context .exchange (), context );
8385 }
8486
87+ @ SuppressWarnings ("unchecked" )
8588 @ Override
8689 public RetryResult retryBindingRecovery (RetryContext context ) throws Exception {
87- return doRetry (bindingRecoveryRetryCondition , bindingRecoveryRetryOperation , context .binding (), context );
90+ return doRetry (( BiPredicate < RecordedEntity , Exception >) bindingRecoveryRetryCondition , bindingRecoveryRetryOperation , context .binding (), context );
8891 }
8992
93+ @ SuppressWarnings ("unchecked" )
9094 @ Override
9195 public RetryResult retryConsumerRecovery (RetryContext context ) throws Exception {
92- return doRetry (consumerRecoveryRetryCondition , consumerRecoveryRetryOperation , context .consumer (), context );
96+ return doRetry (( BiPredicate < RecordedEntity , Exception >) consumerRecoveryRetryCondition , consumerRecoveryRetryOperation , context .consumer (), context );
9397 }
9498
95- protected < T extends RecordedEntity > RetryResult doRetry (BiPredicate <T , Exception > condition , RetryOperation <?> operation , T entity , RetryContext context )
99+ protected RetryResult doRetry (BiPredicate <RecordedEntity , Exception > condition , RetryOperation <?> operation , RecordedEntity entity , RetryContext context )
96100 throws Exception {
97101 int attempts = 0 ;
98102 Exception exception = context .exception ();
@@ -107,7 +111,6 @@ protected <T extends RecordedEntity> RetryResult doRetry(BiPredicate<T, Exceptio
107111 } catch (Exception e ) {
108112 exception = e ;
109113 attempts ++;
110- continue ;
111114 }
112115 } else {
113116 throw exception ;
0 commit comments