• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

URLConnection timeout

 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Servlet that processes a request and returns a result (pretty standard stuff). However, the processing that happens can take some time, and I get a "Connection reset by peer" error message before the processing finishes.
I am connection by a URLConnection, and before I get the "Connection reset by peer" error on the server, I get <URL> file not found, thworn from within getInputStream() of the URLConnection.
This does not happen with shorter processes, just the longer ones.
How can I set the timeout value so that my longer processes will finish? We are using Bluestone's Total-e-server (v.7.3) as the app server an IIS as the web server.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your Servlet code, use the "setMaxInactiveInterval(int seconds)" method of the "HttpSession" class to set the Session Timeout Value for your server. The Servlet API says :
public void setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. A negative time indicates the session should never timeout.
Parameters:
interval - An integer specifying the number of seconds
 
Joel McNary
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by arul senthil:
The Servlet API says :
...between client requests before the servlet container will invalidate this session....


Unfortunately, the problem is not with the length of time between client requests; it is in the length of time between when the client makes a request and gets a response. The client seems to be timing out (the URLConnection), and is disconnecting itself from the server (resulting in the "Connection reset by peer" error message when the server tries to send the response back to the client).
IS there anyway to set the timeout in a java.net.URLConnection?
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic