As was mentioned in commend by @loganfsmyth, in order to call join on JoinHanlde you need to own it (because join "consumes" the JoinHandle). But get method on HashMap provides you with a borrow, not an ownership. So the solution would be to use remove to obtain owned value from HashMap
fn stop_server_command(id: usize) {
if let Some((handler, signal)) = SERVER_INSTANCES.lock().unwrap().remove(&id) {
signal.send(()).unwrap();
handler.join().unwrap();
}
}