You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
would it be possible to cancel a request. My use case is a long polling client that upon shutdown should be able to cancel any currently active request without having to wait for the read timeout.
Regards
Jakob
The text was updated successfully, but these errors were encountered:
if I am not mistaken this is not different (and probably worse) than setting the timeout on the request itself. What I would like to do is to explicitly cancel a running request (e.g. by closing the underlying socket). E.g.
// Thread 1
// Long polling request in a loop
Request request = new JdkRequest("http://www.example.com")
.timeout(1000, 30000): // Long read timeout for long polling request
// Blocks until a response is sent / the read timeout kicks in
request.fetch();
// Thread 2
// System shutdown
// Let's assume this is encapsulated in a shutdown method
request.cancel(); // Closes the socket
Hi,
would it be possible to cancel a request. My use case is a long polling client that upon shutdown should be able to cancel any currently active request without having to wait for the read timeout.
Regards
Jakob
The text was updated successfully, but these errors were encountered: