Source:
<code>private void peekEventsFromIncompleteTransactions(List<GatewaySenderEventImpl> batch, PartitionedRegion prQ) { if (!mustGroupTransactionEvents()) { return; } Map<TransactionId, Integer> incompleteTransactionIdsInBatch = getIncompleteTransactionsInBatch(batch); if (incompleteTransactionIdsInBatch.size() == 0) { return; } <START> boolean areAllEventsForTransactionsInBatch = true; <END> for (Map.Entry<TransactionId, Integer> pendingTransaction : incompleteTransactionIdsInBatch .entrySet()) { TransactionId transactionId = pendingTransaction.getKey(); int bucketId = pendingTransaction.getValue(); boolean areAllEventsForTransactionInBatch = false; int retries = 0; while (!areAllEventsForTransactionInBatch && retries++ < GET_TRANSACTION_EVENTS_FROM_QUEUE_RETRIES) { List<Object> events = peekEventsWithTransactionId(prQ, bucketId, transactionId); for (Object object : events) { GatewaySenderEventImpl event = (GatewaySenderEventImpl) object; batch.add(event); peekedEvents.add(event); areAllEventsForTransactionInBatch = event.isLastEventInTransaction(); if (logger.isDebugEnabled()) { logger.debug( "Peeking extra event: {}, bucketId: {}, isLastEventInTransaction: {}, batch size: {}", event.getKey(), bucketId, event.isLastEventInTransaction(), batch.size()); } } } if (!areAllEventsForTransactionInBatch) { areAllEventsForTransactionsInBatch = false; logger.warn("Not able to retrieve all events for transaction after tries", transactionId, retries); } } if (!areAllEventsForTransactionsInBatch) { stats.incBatchesWithIncompleteTransactions(); } }</code><technical_language>name of this variable is similar existing areAllEventsForTransactionInBatch, is confusing. Please rename of clearer keeping track of</technical_language>

Target:
private void peekEventsFromIncompleteTransactions(List<GatewaySenderEventImpl> batch, PartitionedRegion prQ) { if (!mustGroupTransactionEvents()) { return; } Map<TransactionId, Integer> incompleteTransactionIdsInBatch = getIncompleteTransactionsInBatch(batch); if (incompleteTransactionIdsInBatch.size() == 0) { return; } boolean batchHasIncompleteTransactions = false; for (Map.Entry<TransactionId, Integer> pendingTransaction : incompleteTransactionIdsInBatch .entrySet()) { TransactionId transactionId = pendingTransaction.getKey(); int bucketId = pendingTransaction.getValue(); boolean areAllEventsForTransactionInBatch = false; int retries = 0; while (!areAllEventsForTransactionInBatch && retries++ < GET_TRANSACTION_EVENTS_FROM_QUEUE_RETRIES) { List<Object> events = peekEventsWithTransactionId(prQ, bucketId, transactionId); for (Object object : events) { GatewaySenderEventImpl event = (GatewaySenderEventImpl) object; batch.add(event); peekedEvents.add(event); areAllEventsForTransactionInBatch = event.isLastEventInTransaction(); if (logger.isDebugEnabled()) { logger.debug( "Peeking extra event: {}, bucketId: {}, isLastEventInTransaction: {}, batch size: {}", event.getKey(), bucketId, event.isLastEventInTransaction(), batch.size()); } } } if (!areAllEventsForTransactionInBatch) { batchHasIncompleteTransactions = true; logger.warn("Not able to retrieve all events for transaction after tries", transactionId, retries); } } if (batchHasIncompleteTransactions) { stats.incBatchesWithIncompleteTransactions(); } }