TException {
NetAddress ret = null;
try {
ret = mMasterInfo.getWorker(random, host);
} catch (UnknownHostException e) {
throw new NoWorkerException(e.getMessage());
}
if (ret == null) {
if (random) {
throw new NoWorkerException("No worker in the system");
} else {
throw new NoWorkerException("No local worker on " + host);
}
}
return ret;
}