private synchronized void process(Server s_Server, boolean b_add) { if (b_add) { this.l_Servers.add(s_Server); } else { Iterator<Server> i_servers = this.l_Servers.iterator(); while (i_servers.hasNext()) { Server p = i_servers.next(); if (p == s_Server) { i_servers.remove(); qi_AvailableIDs.offer(p.getID() - 200); MainServer.printInformation( "Removed " + p.getServername() + " from the list of all servers"); } } } }
/** * Returns the Server with the specified ID * * @param id the ID you're looking for * @return teh corresponding server */ public Server findServer(int id) { for (Server s : this.l_Servers) { if (s.getID() == id) return s; } return null; }