public void run() { while (running) { try { ignore.acquireUninterruptibly(); if (!running) break; ignore.release(); if (srv == null) srv = new ServerSocket(port); if (connecting == null) { connecting = new ServerConnection(); } if (connecting.connect(srv, password)) { add(connecting); owner.add(connecting, privilege); connecting = null; } } catch (IOException e) { if (running && !isIgnoring()) { owner.println("Port unavailable, please select a different port."); owner.println("Ignoring new connections."); ignore(true); } } } }