private String resolveIpAddress(String hostname, DirContext ctx) {
		try {
			Attribute dnsRecord = lookup(hostname, ctx, "A");
			// There should be only one A record, therefore it is save to return
			// only the first.
			return dnsRecord.get().toString();
		}
		catch (NamingException e) {
			throw new DnsLookupException("DNS lookup failed for: " + hostname, e);
		}

	}
private String resolveIpAddress ( String hostname , DirContext ctx ) { try { Attribute dnsRecord = lookup ( hostname , ctx , "A" ) ; return dnsRecord . get ( ) . toString ( ) ; } catch ( NamingException e ) { throw new DnsLookupException ( "DNS lookup failed for: " + hostname , e ) ; } }
resolveServiceIpAddress().