java.net.URL Timeouts

Sylvain Wallez:

If your application uses java.net.URL, and chances it does are very high, and you are using Sun's JVM (since 1.4.2), you should set the sun.net.client.defaultConnectTimeout and sun.net.client.defaultReadTimeout system properties to a reasonable value. Otherwise, if a remote site hangs, your application or server will also hang.

Useful to know…

One Response to “java.net.URL Timeouts”

  1. Bah Says:

    To be honest, it sucks. It assumes that you want the same timeout across the board. Rather like their ‘ginger stepchild’ logging implementation. How about modifying the connection object.

    You didn’t write Java, I know. This isn’t a dig at you in any way. It just smacks of globals when Java is supposed to be object oriented.


Leave a Reply

(Valid OpenIDs will skip moderation)

Alternatively, subscribe to the Atom feed.