I have the following little code snippet:
InetAddress address = InetAddress.getByName(host); if(address.isReachable(TIMEOUT_IN_MILLISECONDS))
Some of the addresses need longer time to be resolved. InetAddress has a cache to store successful and unsuccessful resolutions. Also, make a threadpool. You can improve the performance