I'm not particularly happy with the way this code looks, but I like
the result. Otherwise exceptions are like these:
* stream was reset: CANCEL
* Socket closed
* Canceled
These replace requestBodyEnd() / responseBodyEnd() in some failure scenarios.
They may also be issued in cases where no event was published previously.
This is the payoff that preceding changes have been working towards.
This splits StreamAllocation into three parts:
- ExchangeFinder: strategy to allocate connections for exchanges
- Exchange: a single request/response pair
- Transmitter: a sequence of exchanges for a Call
The refactoring isn't totally complete, but this should be the last
big one.
https://github.com/square/okhttp/issues/4603
Today we have to suppress 'connectionAcquired' events because we attach the
constructed connection and then replace it with the pooled one. This changes
the logic to use separate fields for the connecting connection vs. the
pooled one.
This changes failure recovery to only attempt when the failure
occurs when OkHttp is doing I/O. If a failure is triggered by
something else (such as a bad RequestBody or Interceptor) then
that failure will not be retried.
https://github.com/square/okhttp/issues/4603
This creates a new class ResponseBodySource that manages events and
connections. It's symmetric with our existing RequestBodySink class.
Continuing to work towards these things having their own lifecycles
that are separate from HTTP framing mechanics.
https://github.com/square/okhttp/issues/4603
Our 'Internal' trampoline really gets in the way with this one. Just
move the actual implementation code into its own type so there isn't
as much indirection.
Unfortunately we can't easily make RealConnectionPool extend from
ConnectionPool because otherwise we'd be open to any user-provided
connection pools and our API isn't that complete yet.
This is a mechanical refactoring that changes all code that directly
accesses a StreamAllocation to instead access a Transmitter. The
next step is to combine StreamAllocation and Transmitter into
a single class.
* Build with 3 targets
* Update maven
* remove jdk 12 ea
* Try without errorprone temporarily
* Still set 1.8
* javadoc tolerance
* Profiles for 10 + 11
* More tolerant
* JDK 11 test skipping
* Cleanup imports
* Link to github issues
* Support JDK 12 building
* Dispatcher#promoteAndExecute is no longer quadratic
* Maintain map internally
* Factor out two deques to RunningCall class
* Checkstyle
* Revert map-based implementation
* RealCall tracks calls per host using an AtomicInteger
* Loop through both ready and queued
* Empty commit for CI
The most awkward part of this is the changes to the way MockResponse
handled chunked encoding. It used to consider trailers a part of its
chunked response; now it does not.
The connection leak in ConnectionReuseTest.connectionsAreNotReusedIfNetworkInterceptorInterferes() contaminated the shared connection pool and failed tests in CallTest.
Also removed calls to ConnectionPool.evictAll() that became redundant.