Skip to content

Commit 900c76f

Browse files
committed
Merge branch '4.4.x-stable' into 4.x.x-stable
2 parents 1238701 + 5fcd92e commit 900c76f

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,8 @@ public void automaticallyRecover(AutorecoveringConnection connection, Connection
600600
final RecoveryAwareChannelN newChannel = (RecoveryAwareChannelN) connDelegate.createChannel(this.getChannelNumber());
601601
if (newChannel == null)
602602
throw new IOException("Failed to create new channel for channel number=" + this.getChannelNumber() + " during recovery");
603+
newChannel.inheritOffsetFrom(defunctChannel);
603604
this.delegate = newChannel;
604-
this.delegate.inheritOffsetFrom(defunctChannel);
605605

606606
this.notifyRecoveryListenersStarted();
607607
this.recoverShutdownListeners();

src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
* @since 3.3.0
3535
*/
3636
public class RecoveryAwareChannelN extends ChannelN {
37-
private long maxSeenDeliveryTag = 0;
38-
private long activeDeliveryTagOffset = 0;
37+
private volatile long maxSeenDeliveryTag = 0;
38+
private volatile long activeDeliveryTagOffset = 0;
3939

4040
/**
4141
* Construct a new channel on the given connection with the given
@@ -83,21 +83,19 @@ private AMQImpl.Basic.Deliver offsetDeliveryTag(AMQImpl.Basic.Deliver method) {
8383

8484
@Override
8585
public void basicAck(long deliveryTag, boolean multiple) throws IOException {
86-
// FIXME no check if deliveryTag = 0 (ack all)
8786
long realTag = deliveryTag - activeDeliveryTagOffset;
88-
// 0 tag means ack all
89-
if (realTag >= 0) {
87+
// 0 tag means ack all when multiple is set
88+
if (realTag > 0 || (multiple && realTag == 0)) {
9089
transmit(new Basic.Ack(realTag, multiple));
9190
metricsCollector.basicAck(this, deliveryTag, multiple);
9291
}
9392
}
9493

9594
@Override
9695
public void basicNack(long deliveryTag, boolean multiple, boolean requeue) throws IOException {
97-
// FIXME no check if deliveryTag = 0 (nack all)
9896
long realTag = deliveryTag - activeDeliveryTagOffset;
99-
// 0 tag means nack all
100-
if (realTag >= 0) {
97+
// 0 tag means nack all when multiple is set
98+
if (realTag > 0 || (multiple && realTag == 0)) {
10199
transmit(new Basic.Nack(realTag, multiple, requeue));
102100
metricsCollector.basicNack(this, deliveryTag);
103101
}

0 commit comments

Comments
 (0)