JDK-4532321 : No timeout in java.net.HttpURLConnection
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-11-28
  • Updated: 2001-11-28
  • Resolved: 2001-11-28
Related Reports
Duplicate :  
Description

Name: nt126004			Date: 11/28/2001


java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)

There doesn't seem to be any facility for timing out an HttpURLConnection.  You
should be able to specify the number of milliseconds that you are willing to
wait for the connection to be established, before taking an alternate course of
processing (likely through catching an exception).

I would suggest that the timeout I am requesting, would probably be an optional 
parameter to the openConnection() method.
(Review ID: 135189) 
======================================================================

Comments
EVALUATION See http://java.sun.com/j2se/1.4/docs/guide/net/properties.html. For the connect timeout the property is sun.net.client.defaultConnectTimeout. The more general requirement to set socket options on the underlying sockets used by protocol handlers is tracked in bug 4143518 so closing as a duplicate. ###@###.### 2001-11-28
28-11-2001