-
Notifications
You must be signed in to change notification settings - Fork 12k
[ISSUE #3968]RemotingCommand decodeCommandCustomHeader optimized.
#3965
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
[ISSUE #3968]RemotingCommand decodeCommandCustomHeader optimized.
#3965
Conversation
1. avoid java reflection `setAccessible` each time 2. direct compare field Class without `getCanonicalName`.
decodeCommandCustomHeader optimized.decodeCommandCustomHeader optimized.
…nto optimize_remoting_command_decode
Codecov Report
@@ Coverage Diff @@
## develop #3965 +/- ##
=============================================
+ Coverage 47.68% 47.88% +0.20%
- Complexity 4972 5000 +28
=============================================
Files 633 633
Lines 42579 42510 -69
Branches 5589 5574 -15
=============================================
+ Hits 20305 20358 +53
+ Misses 19764 19651 -113
+ Partials 2510 2501 -9
Continue to review full report at Codecov.
|
|
|
||
| public static RemotingCommand createResponseCommand(int code, String remark, | ||
| Class<? extends CommandCustomHeader> classHeader) { | ||
| Class<? extends CommandCustomHeader> classHeader) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert irrelevant modifications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
|
|
||
| public CommandCustomHeader decodeCommandCustomHeader( | ||
| Class<? extends CommandCustomHeader> classHeader) throws RemotingCommandException { | ||
| Class<? extends CommandCustomHeader> classHeader) throws RemotingCommandException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert irrelevant modifications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
| } catch (InstantiationException e) { | ||
| return null; | ||
| } catch (IllegalAccessException e) { | ||
| } catch (InstantiationException | IllegalAccessException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since 4.9.3 we should keep compatible under java 1.6, so you should revert this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
| if (fields == null) { | ||
| fields = classHeader.getDeclaredFields(); | ||
|
|
||
| fields = Arrays.stream(fields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.6 incompatible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed. and this remind me to avoid create new Field[] here which improve the performance! thank you~
| return "RemotingCommand [code=" + code + ", language=" + language + ", version=" + version + ", opaque=" + opaque + ", flag(B)=" | ||
| + Integer.toBinaryString(flag) + ", remark=" + remark + ", extFields=" + extFields + ", serializeTypeCurrentRPC=" | ||
| + serializeTypeCurrentRPC + "]"; | ||
| + Integer.toBinaryString(flag) + ", remark=" + remark + ", extFields=" + extFields + ", serializeTypeCurrentRPC=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert irrelevant modifications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
areyouok
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve this PR.
but I don't known if we should add a module. maybe you can run the test locally.
let's listen to other person's opinion
fix #3968
setAccessibleeach timegetCanonicalName.