Refactor the PingTask as an inner private class; do not add the recent hosts twice