chore: dedupe pipeline call-state httpClient and reload/toBlocking#192
Merged
Conversation
Behavior-preserving cleanups in the http/pipeline runtime:
- Drop the stored httpClient from PipelineCallState / AsyncPipelineCallState.
It was always the same instance as pipeline.httpClient; the sole readers
(PipelineNext / AsyncPipelineNext) now reach it through pipeline, removing
the field, the constructor parameter, and an argument at every call site.
- reload() now replays through append() instead of re-implementing the same
stage-dispatch loop, keeping the bucketing policy in one place.
- build() materializes the ordered step list with List.toTypedArray() rather
than a manual index-lambda Array(size){}.
- toBlocking() delegates to AsyncHttpClient.asBlocking() instead of hand-rolling
the identical blocking-get with interrupt handling and ExecutionException
unwrapping, leaving a single definition of the cancellation contract.
- Correct Stage.order's KDoc and a test comment: the builder emits in Stage
declaration order (Stage.entries), not by reading the numeric order value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Behavior-preserving cleanups in the
sdk-coreHTTP pipeline runtime (org.dexpace.sdk.core.http.pipeline). No public-API or observable-behavior change; each item removes code that duplicates logic already living one call away.Closes #171.
Changes
Drop the stored
httpClientfromPipelineCallState/AsyncPipelineCallState. The field was always the same instance aspipeline.httpClient— the cursor is only ever built fromsend/sendAsync(which pass their own client) and fromcopy(which forwards it). The sole readers,PipelineNext.processandAsyncPipelineNext.processAsync, now reach the client throughpipeline, which removes the field, the constructor parameter, and one argument from every construction site. The async file also drops its now-unusedAsyncHttpClientimport.reload()replays throughappend(). It previously re-implementedappend()'s stage-dispatch loop verbatim. Sincereloadclears the pillar map first and a flattened list holds at most one pillar per stage, the pillar-replacement callback never fires during replay — bucketing policy now lives in one place.build()usesList.toTypedArray()instead of the manualArray(size) { ordered[it] }, in both the sync and async builders.flatten()returns a non-null element list, so this yields the exact array type the constructors expect, empty case included.toBlocking()delegates toAsyncHttpClient.asBlocking()rather than hand-rolling the identical blockingfuture.get()with interrupt handling (restore-flag →cancel(true)→InterruptedIOException) andExecutionExceptionunwrapping. The cancellation contract now has a single definition.Doc fix for
Stage.order. The KDoc claimed the builder emits steps by reading the numericorder; it doesn't —flatten()walksStage.entries(declaration order) and never consultsorder. The values happen to ascend with declaration order, which is why output stays sorted. Corrected the KDoc and the matching test comment so nobody tries to reorder steps by renumberingorder. Theorderproperty is retained as a stable inspection key.Verification
./gradlew :sdk-core:buildpasses — ktlint, detekt,allWarningsAsErrors, binary-compatibility check, tests, and the coverage gate. All changed declarations areinternalor signature-unchanged, so there is noapiCheckimpact.