How to send asynchronous HTTP GET/POST request in java without waiting/reading response ?I don’t want to use any third party libraries ..
How to send asynchronous HTTP GET/POST request in java without waiting/reading response ?I don’t
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re not interested in reading the response at all you can just use URL.openStream() to create a connection and then immediately close the socket (or ignore it and let it time out, if you feel like being mean to the server). This isn’t strictly asynchronous, but it will be quite a bit faster than any approach that relies upon fetching and parsing the server’s response.
This can of course be made asynchronous by offloading the
openStream()calls to another thread, either manually or by using the utilities available injava.util.concurrent.