LinkedIn Java SDK: Unclear cancellation behavior of asynchronous requests
0 reputation · 19 May 2023, 13:34 UTC
Goal
Investigate how cancelling an asynchronous LinkedIn API call via the official Java SDK affects the underlying HTTP transaction, response parsing, and connection pool usage.
Constraints & Uncertainty
The SDK’s asynchronous methods return a ListenableFuture that lacks a direct cancel() method, relying instead on the underlying HTTP client’s cancellation mechanics. Documentation does not clarify whether LinkedIn’s server aborts processing when the client closes the connection, nor does it specify the HTTP status code that would be returned for a cancelled request. Additionally, the SDK’s timeout configuration applies only to socket and connect timeouts, with no explicit total request deadline that encompasses retries.
Unresolved Questions
- When a
ListenableFutureis cancelled, does the SDK immediately terminate the HTTP request on the wire, or does it continue until a response is received? - What HTTP status code, if any, does LinkedIn return to the client when the connection is closed mid‑request, and is this code consistent across success, throttling, and server error responses?
- Is there a mechanism to enforce a total request deadline that includes retry attempts, or must developers implement this logic externally?