[transactions] Fix minor leak of FlushContext
@@ -40,7 +40,6 @@ import org.apache.bookkeeper.mledger.AsyncCallbacks;
import org.apache.bookkeeper.mledger.ManagedLedger;
import org.apache.bookkeeper.mledger.ManagedLedgerException;
import org.apache.bookkeeper.mledger.Position;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.pulsar.common.allocator.PulsarByteBufAllocator;
/***
@@ -418,13 +417,15 @@ public class TxnLogBufferedWriter<T> {
}
private void failureCallbackByContextAndRecycle(FlushContext flushContext, ManagedLedgerException ex){
- if (flushContext == null || CollectionUtils.isEmpty(flushContext.asyncAddArgsList)){
+ if (flushContext == null) {
return;
}
try {
+ if (flushContext.asyncAddArgsList != null) {
for (AsyncAddArgs asyncAddArgs : flushContext.asyncAddArgsList) {
failureCallbackByArgs(asyncAddArgs, ex, false);
}
+ }
} finally {
flushContext.recycle();
}
