void dispatch(InboundRequest request) throws IOException, NoSuchObject {
if (!exported){ // optimisation to avoid locking.
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "this={0}, not exported", this);
}
throw new NoSuchObject();
}
Thread current = Thread.currentThread();
boolean exitNormally = true;
boolean callerAdded = false;
try {
InvocationDispatcher id = null;
lock.lockInterruptibly();
try {
callerAdded = calls.add(current);
if (!exported || invocationDispatcher == null) { // check again now we've got the lock.
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "this={0}, not exported", this);
}
throw new NoSuchObject();
}
id = invocationDispatcher;
} finally {
lock.unlock();
}
Remote impl = implRef.getImpl();
if (impl == null) {
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "this={0}, garbage collected", this);
}
throw new NoSuchObject();
}
interrupted(current);
dispatch(request, id, impl, current);
interrupted(current);
} catch (InterruptedException ex) {