From 4bfbb96dfe7dcfd12917b40173f07de7e076449f Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 23 Mar 2005 01:56:54 +0000 Subject: [PATCH] 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 --- src/java/com/threerings/resource/Handler.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/java/com/threerings/resource/Handler.java b/src/java/com/threerings/resource/Handler.java index bbd1c9e1b..b4fb50123 100644 --- a/src/java/com/threerings/resource/Handler.java +++ b/src/java/com/threerings/resource/Handler.java @@ -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