Refactor SpringFenceHandler to Improve Code Structure and Reduce Complexity
Check Ahead
-
[x] I have searched the issues of this repository and believe that this is not a duplicate.
-
[x] I am willing to try to implement this feature myself.
Why you need it?
I've been seata TCC model to research on, when I saw the org. Apache. Seata. Rm. Fence. SpringFenceHandler this code when I found the following questions, I wonder whether if necessary I can try to refactor the code
-
The class is a bit large and the logic is too complex. handler should serve as a processing entry point instead of integrating all the logic within it.
-
Database operations, transaction processing, and asynchronous cleaning are all piled up together. It will be very painful to make changes later
我最近在研究seata的TCC模式的实现,当我看到org.apache.seata.rm.fence.SpringFenceHandler这块代码的时候我发现有以下几个问题,我在想如果有必要的话我是否可以尝试重构这块的代码
1、类稍微有点大,逻辑太杂,handler应该作为一个处理入口,而不是柔和所有的逻辑在里面,
2、数据库操作、事务处理、异步清理这些东西全堆一块了,后面改起来会很痛苦
How it could be?
No response
Other related information
No response
You can submit your initial refactoring proposal for community review. For example, you can describe how many classes you would split it into, the responsibilities of each class, which design patterns you would use, and so on.
Also, I believe that test code is essential when performing refactoring.
Could you please check whether there are existing tests that cover the part you’re planning to refactor? If not, I think we should add those tests first before proceeding with the refactoring.
Also, I believe that test code is essential when performing refactoring.
Could you please check whether there are existing tests that cover the part you’re planning to refactor? If not, I think we should add those tests first before proceeding with the refactoring.
The relevant test coverage is 0. I will first submit a pr to supplement these test cases