@ Override public InetSocketAddress lookup ( final Identifier id ) throws Exception { return cache . get ( id , new Callable < InetSocketAddress > ( ) { @ Override public InetSocketAddress call ( ) throws Exception { final int origRetryCount = NameLookupClient . this . retryCount ; int retriesLeft = origRetryCount ; while ( true ) { try { return remoteLookup ( id ) ; } catch ( final NamingException e ) { if ( retriesLeft <= 0 ) { throw e ; } else { final int currentRetryTimeout = NameLookupClient . this . retryTimeout * ( origRetryCount - retriesLeft + 1 ) ; LOG . log ( Level . WARNING , "Caught Naming Exception while looking up " + id + " with Name Server. Will retry " + retriesLeft + " time(s) after waiting for " + currentRetryTimeout + " msec." ) ; Thread . sleep ( currentRetryTimeout ) ; -- retriesLeft ; } } } } } ) ; }
Finds an address for an identifier .