File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes HTTPConnection timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "HTTPConnection timeout" Watch "HTTPConnection timeout" New topic

HTTPConnection timeout

Vijaya Patil

Joined: Sep 02, 2011
Posts: 5


I am using a client app in which we need to make a SSL connection to the HOST. This code is written in a class and called from struts action class.

Now when the host is down for some reason the connect call keeps trying for 5 minutes blocking the underlying socket resources. The sockets getting blocked are more in number so this results in db connections getting queued. Once 5 min is over the queued request are processed and there is DB spike happening.

Since the code base uses JDK 1.4 I cannot use the setConnectTimeout() method.
I will really appreciate your help in knowing how can i stop blocking my resource for 5 minutes? Or Can I use any time counter of my own to forcefully avoid waiting for more time and refuse connecting?

Thanks a lot

Thanks a lot!
Vijaya Patil
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41054
You're in luck - The JavaIoFaq talks about this very problem!

Ping & DNS - my free Android networking tools app
Vijaya Patil

Joined: Sep 02, 2011
Posts: 5

Ulf Dittmer wrote:You're in luck - The JavaIoFaq talks about this very problem!

Thanks Ulf for your quick reply
I agree. Here's the link:
subject: HTTPConnection timeout
Similar Threads
Oracle datasource connection timeouts?
getting errors while running duke's bank application
Jboss connection pool not releasing the connection from pool
To find the run time connection pool size in jboss3.2.1
DatasourceRealm just ain't working