public Process(String name, int pid, int n) { this.name = name; this.port = Utils.REGISTRAR_PORT + pid; this.host = "UNKNOWN"; try { this.host = (InetAddress.getLocalHost()).getHostName(); } catch (UnknownHostException e) { String msg = String.format("Error: getHostName() failed at %s.", this.getInfo()); System.err.println(msg); System.err.println(e.getMessage()); System.exit(1); } this.pid = pid; this.n = n; random = new Random(); /* Accepts connections from one of Registrar's worker threads */ new Thread(new Listener(this)).start(); /* Connect to registrar */ socket = connect(); init(); Utils.out(pid, "Connected."); }