Skip to content

refactor: use !isEmpty() instead of size() > 0 in BrokerOuterAPI#10119

Closed
Senrian wants to merge 7 commits intoapache:developfrom
Senrian:fix/more-isEmpty-2
Closed

refactor: use !isEmpty() instead of size() > 0 in BrokerOuterAPI#10119
Senrian wants to merge 7 commits intoapache:developfrom
Senrian:fix/more-isEmpty-2

Conversation

@Senrian
Copy link

@Senrian Senrian commented Mar 2, 2026

Description

Replace .size() > 0 with !isEmpty() for better code quality and performance.

Changes

  • Multiple files: 14 occurrences fixed

This is a minor code quality improvement.

Senrian and others added 7 commits March 2, 2026 03:06
…pache#9249)

When message delivery fails in ScheduleMessageService.DeliverDelayedMessageTimerTask,
the offset parameter passed to scheduleNextTimerTask was incorrect.
Using nextOffset would skip the current message and potentially lose messages.
This fix changes to use currOffset to retry the current message immediately.

Compare with version 4.9.8 which uses nextOffset in the loop but correctly
passes currOffset when delivery fails.
Replace .size() > 0 with !isEmpty() and .size() == 0 with isEmpty()
for better code quality and performance.

Issue: code quality improvement
- BrokerController: use isEmpty() for brokerMemberGroup.getBrokerAddrs()
- DefaultLitePullConsumerImpl: use isEmpty() for messageQueues
Replace .size() > 0 with !isEmpty() in BrokerOuterAPI.java
for better code quality.
Multiple files:
- DefaultMQPullConsumerImpl.java
- DefaultLitePullConsumerImpl.java
- AsyncTraceDispatcher.java
@RongtongJin RongtongJin closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants