protected String getRemoteHostName ( final String remoteIp ) { val revDNS = new ReverseDNSRunnable ( remoteIp ) ; val t = new Thread ( revDNS ) ; t . start ( ) ; try { t . join ( this . timeout ) ; } catch ( final InterruptedException e ) { LOGGER . debug ( "Threaded lookup failed. Defaulting to IP [{}]." , remoteIp , e ) ; } val remoteHostName = revDNS . getHostName ( ) ; LOGGER . debug ( "Found remote host name [{}]." , remoteHostName ) ; return StringUtils . isNotBlank ( remoteHostName ) ? remoteHostName : remoteIp ; }
Convenience method to perform a reverse DNS lookup . Threads the request through a custom Runnable class in order to prevent inordinately long user waits while performing reverse lookup .