@@ -84,21 +84,27 @@ private AMQImpl.Basic.Deliver offsetDeliveryTag(AMQImpl.Basic.Deliver method) {
84
84
@ Override
85
85
public void basicAck (long deliveryTag , boolean multiple ) throws IOException {
86
86
long realTag = deliveryTag - activeDeliveryTagOffset ;
87
- // 0 tag means ack all when multiple is set
88
- if (realTag > 0 || (multiple && realTag == 0 )) {
89
- transmit (new Basic .Ack (realTag , multiple ));
90
- metricsCollector .basicAck (this , deliveryTag , multiple );
87
+ if (multiple && deliveryTag == 0 ) {
88
+ // 0 tag means ack all when multiple is set
89
+ realTag = 0 ;
90
+ } else if (realTag <= 0 ) {
91
+ return ;
91
92
}
93
+ transmit (new Basic .Ack (realTag , multiple ));
94
+ metricsCollector .basicAck (this , deliveryTag , multiple );
92
95
}
93
96
94
97
@ Override
95
98
public void basicNack (long deliveryTag , boolean multiple , boolean requeue ) throws IOException {
96
99
long realTag = deliveryTag - activeDeliveryTagOffset ;
97
- // 0 tag means nack all when multiple is set
98
- if (realTag > 0 || (multiple && realTag == 0 )) {
99
- transmit (new Basic .Nack (realTag , multiple , requeue ));
100
- metricsCollector .basicNack (this , deliveryTag );
100
+ if (multiple && deliveryTag == 0 ) {
101
+ // 0 tag means nack all when multiple is set
102
+ realTag = 0 ;
103
+ } else if (realTag <= 0 ) {
104
+ return ;
101
105
}
106
+ transmit (new Basic .Nack (realTag , multiple , requeue ));
107
+ metricsCollector .basicNack (this , deliveryTag );
102
108
}
103
109
104
110
@ Override
0 commit comments