this.refuse();
return;
}
Record question = this.query.getMessage().getQuestion();
Backend backend = this.backends.lookup(question.getType());
if (backend == null) {
this.refuse();
return;
}
this.ident = backend.makeKey(question);
logger.debug("Checking cache [key={}]", this.ident);
// check cache
Element lmnt = this.cache.get(this.getIdent());
if(lmnt != null) {
if(lmnt.getObjectValue() == DontExist) {
this.timeout();
} else {
Record record = (Record) lmnt.getObjectValue();
this.answer(record, true);
}
return;
}
logger.debug("Asking backend [query={}]", this.query);
// Park this query awaiting result from backend
this.waitHere.keep(this);
try {
// Notify backend we need an update
backend.notify(question);
} catch (NoSuchDomainException e) {
this.waitHere.discard(this);
this.unknown();
} catch (BackendCommunicationException e) {
this.waitHere.discard(this);