This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am facing a weird problem. I am writing some code in one eclipse plugin.
Plugin makes a request to server using java.net.HTTPURLConnection by writing some data to output stream and reads the returned data from the inputStream.
When it tries to read the data from the inputStream returned by the connection (see code snippet below)
where b is byte. It throws SocketTimedOutExcption.
Now as far as i understand HTTPURLConnection class (may be i am wrong) . It by default has a ReadTimeOut set to 0 (0 means infinite wait here)..
So in my opinion it should wait until unless server returns the response. Also HTTPURLConnection is Synchronous, so it should wait until unless server returns data (within timeout limit).
I put the above code in while loop to retry and after retrying a couple of time it works. By retry i mean i sent my request only once but i retry on reading the inputStream (response from server).
Problem became worst when we noticed that its only replicable ONLY ON install i.e. it dosen't come when i tried debugging it in development enviornemnt.
If you want full code i will paste that here also.. just let me know
I'm curious to see why this is happening. I'll try installing the plugin. Can you attach it as a zip?
Joined: Oct 07, 2008
Hi, i can not share the plugin. As its my company code and i am bound not to do so, legally.. I am really really sorry for that. Can you tell me how you would have debug it? i mean does taking java dumps or anything like that will help? or you can guide me what should i do.. Thanks for your reply..