We need to override hashCode() and equals() because the default
implementations do a fucking DNS lookup on the host of the URL. The degree to which that violates expectations about the "expense" of calling hashCode() is so astronomical as to be unexpressible without complicated metaphor. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3421 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -68,6 +68,18 @@ public class Handler extends URLStreamHandler
|
||||
AttachableURLFactory.attachHandler("resource", Handler.class);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
protected int hashCode (URL url)
|
||||
{
|
||||
return String.valueOf(url).hashCode();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
protected boolean equals (URL u1, URL u2)
|
||||
{
|
||||
return String.valueOf(u1).equals(String.valueOf(u2));
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
protected URLConnection openConnection (URL url)
|
||||
throws IOException
|
||||
|
||||
Reference in New Issue
Block a user