Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize ConsumeMessageOrderlyService enumerated types of comparison #7408

Closed

Conversation

fqgsoftwareengineer
Copy link

Optimized performance

Which Issue(s) This PR Fixes

Optimized performance:
The equals of enumeration types can be replaced by ==, which improves performance and is safer at compile and run time.
see:

  1. https://docs.oracle.com/javase/specs/jls/se9/html/jls-8.html#jls-8.9
  2. https://stackoverflow.com/questions/1750435/comparing-java-enum-members-or-equals

Brief Description

How Did You Test This Change?

Just compare the pressure measurements with the previous ones

@fqgsoftwareengineer fqgsoftwareengineer changed the title Update ConsumeMessageOrderlyService.java Optimize ConsumeMessageOrderlyService enumerated types of comparison Sep 27, 2023
@@ -86,7 +86,7 @@ public ConsumeMessageOrderlyService(DefaultMQPushConsumerImpl defaultMQPushConsu
}

public void start() {
if (MessageModel.CLUSTERING.equals(ConsumeMessageOrderlyService.this.defaultMQPushConsumerImpl.messageModel())) {
if (MessageModel.CLUSTERING==ConsumeMessageOrderlyService.this.defaultMQPushConsumerImpl.messageModel()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need blank space around the equal operator

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for good code style

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space formatting has been added

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