io.seata.core.rpc.netty.NettyRemotingServer#registerProcessor代码建议优化

ovfsdjhp  于 2个月前  发布在  .NET
关注(0)|答案(4)|浏览(50)

Why you need it?

Is your feature request related to a problem? Please describe in details
将硬性编码转成用SPI进行解耦和扩展,使用getMessageTypes()方法来获取类型,进行注册到processorTable中

How it could be?

A clear and concise description of what you want to happen. You can explain more about input of the feature, and output of it.
List<RemotingProcessor> processors = ServicLoader.load(RemotingProcessor.class); .....

Add any other context or screenshots about the feature request here.

s6fujrry

s6fujrry1#

你这么做的目的是什么?

czfnxgou

czfnxgou2#

为了进行扩展和版本迭代不需要改动原来代码,只需要更改SPI的文件,减少硬性编码

k4emjkb1

k4emjkb13#

server 端的 spi 意义不大吧。

2eafrhcq

2eafrhcq4#

@juckTom So according to the figure above ,we need 5 types of SPI to load?

相关问题