birschick-bq opened a new pull request, #3930:
URL: https://github.com/apache/thrift/pull/3930
<!-- Explain the changes in the pull request below: -->
This pull request introduces a new per-call transport mechanism for
`THttpTransport`, allowing each logical Thrift call to use a distinct HTTP
request/response cycle. This improves resource management, error isolation, and
concurrency for HTTP-based Thrift clients. The implementation includes a new
interface, a per-call transport class, and comprehensive tests to verify
correct behavior and resource disposal.
### Per-call transport implementation
* Added the `ITPerCallTransportProvider` interface to define a standard
method for creating per-call transports.
(`lib/netstd/Thrift/Transport/ITPerCallTransportProvider.cs`)
* Implemented `THttpPerCallTransport`, a new internal class that manages
request/response streams for a single Thrift call, ensuring proper disposal and
isolation from the parent transport.
(`lib/netstd/Thrift/Transport/Client/THttpPerCallTransport.cs`)
* Updated `THttpTransport` to implement `ITPerCallTransportProvider` and
provide the `CreatePerCallTransportAsync` method, which returns a new
`THttpPerCallTransport` for each call.
(`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)
[[1]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeL35-R35)
[[2]](diffhunk://#diff-f12dc2850124c3b5b76d6d80850c70e79d0b6735f7c701ba23b2dfac2e8f1cfeR301-R373)
### Internal refactoring and supporting methods
* Added an internal `SendAsync` method to `THttpTransport` to handle sending
the request stream and returning the HTTP response, with robust exception
handling and resource cleanup.
(`lib/netstd/Thrift/Transport/Client/THttpTransport.cs`)
### Testing
* Added comprehensive unit tests to `THttpTransportTests` to verify per-call
transport behavior, including resource disposal, error handling, concurrency,
and protocol factory integration.
(`lib/netstd/Tests/Thrift.Tests/Transports/THttpTransportTests.cs`)
These changes collectively improve the reliability, testability, and
scalability of HTTP-based Thrift transports by supporting per-call isolation
and robust resource management.
---
<!-- We recommend you review the checklist/tips before submitting a pull
request. -->
- [x] Did you create an [Apache
Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?
([Request account here](https://selfserve.apache.org/jira-account.html), not
required for trivial changes)
- [x] If a ticket exists: Does your pull request title follow the pattern
"THRIFT-NNNN: describe my issue"?
- [ ] Did you squash your changes to a single commit? (not required, but
preferred)
- [x] Did you do your best to avoid breaking changes? If one was needed,
did you label the Jira ticket with "Breaking-Change"?
- [ ] If your change does not involve any code, include `[skip ci]` anywhere
in the commit message to free up build resources.
<!--
The Contributing Guide at:
https://github.com/apache/thrift/blob/master/CONTRIBUTING.md
has more details and tips for committing properly.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]