示例#1
0
 /**
  * Creates a SimpleResolver that will query the specified host
  *
  * @exception UnknownHostException Failure occurred while finding the host
  */
 public SimpleResolver(String hostname) throws UnknownHostException {
   if (hostname == null) {
     hostname = ResolverConfig.getCurrentConfig().server();
     if (hostname == null) hostname = defaultResolver;
   }
   InetAddress addr;
   if (hostname.equals("0")) addr = InetAddress.getLocalHost();
   else addr = InetAddress.getByName(hostname);
   address = new InetSocketAddress(addr, DEFAULT_PORT);
 }
 /**
  * Creates a new Extended Resolver. The default ResolverConfig is used to determine the servers
  * for which SimpleResolver contexts should be initialized.
  *
  * @see SimpleResolver
  * @see ResolverConfig
  * @exception UnknownHostException Failure occured initializing SimpleResolvers
  */
 public ExtendedResolver() throws UnknownHostException {
   init();
   String[] servers = ResolverConfig.getCurrentConfig().servers();
   if (servers != null) {
     for (int i = 0; i < servers.length; i++) {
       Resolver r = new SimpleResolver(servers[i]);
       r.setTimeout(quantum);
       resolvers.add(r);
     }
   } else resolvers.add(new SimpleResolver());
 }