@Override public void remove(Connection connection) { staleConnections.remove(connection); constraintMap.remove(connection); if (connectionToPaths == null) { return; } Path path = (Path) connectionToPaths.remove(connection); algorithm.removePath(path); isDirty = true; if (connectionToPaths.isEmpty()) { unhookAll(); connectionToPaths = null; } else { // Make sure one of the remaining is revalidated so that we can re-route again. queueSomeRouting(); } }