diff --git a/lib/BatchMessageAcker.h b/lib/BatchMessageAcker.h index 7aa8c1fa..fa0392c1 100644 --- a/lib/BatchMessageAcker.h +++ b/lib/BatchMessageAcker.h @@ -43,7 +43,10 @@ class BatchMessageAcker { return prevBatchCumulativelyAcked_.compare_exchange_strong(expectedValue, true); } - const BitSet& getBitSet() const noexcept { return bitSet_; } + virtual const BitSet& getBitSet() const noexcept { + static BitSet emptyBitSet; + return emptyBitSet; + } private: // When a batched message is acknowledged cumulatively, the previous message id will be acknowledged @@ -80,6 +83,8 @@ class BatchMessageAckerImpl : public BatchMessageAcker { return bitSet_.isEmpty(); } + const BitSet& getBitSet() const noexcept override { return bitSet_; } + private: BitSet bitSet_; mutable std::mutex mutex_;