final Call call = calls.remove(id);
final int state = in.readInt(); // read call status
if (state == Status.SUCCESS.state) {
IOReadableWritable value = null;
boolean isNotNull = in.readBoolean();
if (isNotNull) {
final String returnClassName = StringRecord.readString(in);
Class<? extends IOReadableWritable> c = null;
try {
c = ClassUtils.getRecordByName(returnClassName);
} catch (ClassNotFoundException e) {
LOG.error("Could not find class " + returnClassName + ".", e);
}
try {
value = c.newInstance();
} catch (InstantiationException e) {
LOG.error("Could not instantiate object of class " + c.getCanonicalName() + ".", e);
} catch (IllegalAccessException e) {
LOG.error("Error instantiating object of class " + c.getCanonicalName() + ".", e);
}
try {
value.read(new InputViewDataInputStreamWrapper(in)); // read value
} catch(Throwable e) {
LOG.error("Exception while receiving an RPC call", e);
}
}
call.setValue(value);