+ private static Hash cache = new Hash();
+ public static Port newPort(String path, InetAddress bindTo, int port) throws IOException {
+ String canonical = new File(path).getCanonicalPath();
+ Port p = (Port)cache.get(canonical);
+ if (p == null) cache.put(canonical, p = new Port(path, bindTo, port));
+ else Log.warn(Port.class, " sharing " + bindTo+":"+port+" -> "+ (p.bindTo+":"+p.port));
+ p.spawn(bindTo, port);
+ return p;
+ }
+
+ void spawn(InetAddress bindTo, int port) { new PortThread(bindTo, port).start(); }
+ private Port(String path, InetAddress bindTo, int port) {