-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Custom serializer register #1296
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1296 +/- ##
============================================
- Coverage 71.95% 71.95% -0.01%
+ Complexity 784 783 -1
============================================
Files 415 416 +1
Lines 17654 17659 +5
Branches 2752 2752
============================================
+ Hits 12703 12706 +3
Misses 3549 3549
- Partials 1402 1404 +2
... and 4 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
277eee9
to
a093a33
Compare
...remoting-bolt/src/main/java/com/alipay/sofa/rpc/codec/bolt/SofaRpcSerializationRegister.java
Outdated
Show resolved
Hide resolved
...remoting-bolt/src/main/java/com/alipay/sofa/rpc/codec/bolt/SofaRpcSerializationRegister.java
Outdated
Show resolved
Hide resolved
@@ -69,7 +72,10 @@ public class BoltServerProcessor extends AsyncUserProcessor<SofaRequest> { | |||
* 提前注册序列化器 | |||
*/ | |||
static { | |||
SofaRpcSerializationRegister.registerCustomSerializer(); | |||
String extensionAlias = RpcConfigs.getOrDefaultValue(RpcOptions.BOLT_SERIALIZER_REGISTER_EXTENSION, |
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.
If these static code can remove into constructor?
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.
It is designed here as:
- To do the register at same time as before.
- Get config and load extension once.
- Clarify it as ACTION belong to the
BoltServerProcessor
class, not only to a single BoltServerProcessor instance.
...rces/META-INF/services/sofa-rpc/com.alipay.sofa.rpc.codec.bolt.AbstractSerializationRegister
Outdated
Show resolved
Hide resolved
...ng/remoting-bolt/src/test/java/com/alipay/sofa/rpc/codec/bolt/BoltSerializationInitTest.java
Outdated
Show resolved
Hide resolved
...est/resources/META-INF/services/com.alipay.sofa.rpc.codec.bolt.AbstractSerializationRegister
Outdated
Show resolved
Hide resolved
...g/remoting-bolt/src/test/java/com/alipay/sofa/rpc/test/TestSofaRpcSerializationRegister.java
Outdated
Show resolved
Hide resolved
...ng/remoting-bolt/src/test/java/com/alipay/sofa/rpc/codec/bolt/BoltSerializationInitTest.java
Outdated
Show resolved
Hide resolved
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.
LGTM
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.
lgtm
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.
LGTM
* Modify the parsing header method to facilitate expansion (#1325) Co-authored-by: liujianjun.ljj <liujianjun.ljj@antgroup.com> * feat: let use of javassist compatible at jdk 17 (#1316) Co-authored-by: junyuan <zhangminglun.zml@ant-group.com> * upgrade rpc version to 5.10.0-SNAPSHOT (#1326) * upgrade rpc version to 5.10.0-SNAPSHOT * upgrade rpc version to 5.10.0-SNAPSHOT --------- Co-authored-by: liujianjun.ljj <liujianjun.ljj@antgroup.com> * Custom serializer register (#1296) * feat: use extension on serializer register --------- Co-authored-by: 均源 <zhangminglun.zml@antgroup.com> Co-authored-by: junyuan <zhangminglun.zml@ant-group.com> * chore: update version to release (#1328) Co-authored-by: lo1nt <zhangminglun.zml@ant-group.com> * upgrade rpc version to 5.10.1-SNAPSHOT (#1334) Co-authored-by: liujianjun.ljj <liujianjun.ljj@antgroup.com> * support change grpc maxInboundMessageSize (#1333) Co-authored-by: liujianjun.ljj <liujianjun.ljj@antgroup.com> * Fix the unit test message too large problem (#1339) * support change grpc maxInboundMessageSize * fix the debug body message too large problem --------- Co-authored-by: liujianjun.ljj <liujianjun.ljj@antgroup.com> * feat: bump hessian from 3.13.3 to 3.4.0 (#1338) Co-authored-by: Lo1nt <zhangminglun.zml@antgroup.com> * updapte 5.10.1 version to release (#1337) Co-authored-by: Lo1nt <zhangminglun.zml@antgroup.com> * update version * bump hessian * update version * add ci * set verison as 51100 * fix: destory * fix: unit test --------- Co-authored-by: evenliu <evenljj@163.com> Co-authored-by: liujianjun.ljj <liujianjun.ljj@antgroup.com> Co-authored-by: lo1nt <zhangminglun.zml@ant-group.com> Co-authored-by: lo1nt <zhangminglun.zml@antgroup.com>
Motivation:
Currently, the custom serializer is registered by static code block. And once it registered, it could not be modified.
When there are several classes that register custom serializer, the sequence, dependents on sequence of class loading, is unpredictable, and unmodifiable.
Thus, there's no way we define our own serializer (say, for SofaRequest.Class).
The pr here is aiming at making custom serializer registration sequentially.
P.S. And we here still don't want to change the unmodifiable feature (Once a serializer registered, it can never be changed).
Modification:
Apply extension-loader mechanism to let the register work in sequence.
Still, there is an override feature for extension loader, which enables us to substitute the origin register provided by sofa rpc.
Result: