Open JoeCqupt opened 10 months ago
@chuailiwu PTAL
@OrezzerO @nobodyiam
The recent changes encompass a variety of improvements and additions across multiple files, focusing on enhancing callback handling, updating dependencies, refining connection status checks, and adding new test cases. Key modifications include refactoring the CallbackTask
class for better error handling and callback logic, updating Maven dependencies in pom.xml
, and introducing new methods and tests to ensure robust functionality and improved code coverage.
File(s) | Summary of Changes |
---|---|
src/.../RpcInvokeCallbackListener.java |
Refactored CallbackTask class to improve exception handling, error messages, and callback logic. |
.github/workflows/release.yml |
Added a new GitHub Actions workflow for building and releasing the project using Maven. |
pom.xml |
Updated versions of several dependencies and plugins. |
src/.../BaseRemoting.java |
Renamed defalutCommandFactory to commandFactory and updated related methods. |
src/.../Connection.java |
Enhanced isFine() method to include a check for the closed status. |
src/.../InvokeContext.java |
Added RecordContext field and related method. |
src/.../RemotingContext.java |
Implemented Cloneable interface and added write , flush , and clone methods. |
src/.../RpcCommandHandler.java |
Modified run method to clone ctx before processing. |
src/.../RpcRequestProcessor.java |
Added try-finally block for recording start and stop, and handled exceptions during response serialization. |
src/.../SerializerManager.java |
Introduced ReentrantLock for thread safety when retrieving serializers. |
src/test/.../ConnectionTest.java |
Added testIsFine() method to enhance connection handling tests. |
src/test/.../ExceptionTest.java |
Introduced testGetBizClassLoaderException1() to test exception handling in getBizClassLoader() . |
src/test/.../RpcCommandHandlerTest.java |
Added testHandleCommand() and MockUserProcessors class to test RPC command handling. |
src/test/.../ClassCustomSerializerTest.java |
Added testResponseSerialThrowable() for testing Throwable serialization during response. |
sequenceDiagram
participant User
participant RpcCommandHandler
participant RemotingContext
participant ProcessMethod
User->>RpcCommandHandler: Invoke run()
RpcCommandHandler->>RemotingContext: Clone ctx
RpcCommandHandler->>ProcessMethod: Call process(ctx.clone(), m)
ProcessMethod-->>RpcCommandHandler: Return result
RpcCommandHandler-->>User: Return response
In lines of code, where logic flows,
Callbacks dance, and error shows.
Dependencies updated, secure and tight,
Connections checked with all their might.
Tests abound, ensuring grace,
In our code, no flaws we trace.
🐇✨ Code refined, a joyous sight!
[!WARNING]
Review ran into problems
Problems (1)
* Git: Failed to clone repository. Please contact CodeRabbit support.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
It's amazing, I feel like this CI will randomly fail
这个CI有问题,线下跑的单测没问题,CI跑的就报错
线下:
CI: https://github.com/sofastack/sofa-bolt/actions/runs/9377858022/job/25820076402?pr=336#step:5:1472
Why make this change?
The code for resolve response is duplicated。
replace duplicated code by using
RpcResponseResolver.resolveResponseObject
methodSummary by CodeRabbit
New Features
RemotingContext
instances.Bug Fixes
isFine()
method inConnection
to properly check the closed status.Improvements
CallbackTask
class to enhance exception handling, error messages, and callback invocation logic.pom.xml
for improved stability and performance.BaseRemoting
for better clarity.SerializerManager
.Tests