if (!command.isNoreply()) {
this.latchWait(command, operationTimeout);
command.getIoBuffer().free();
this.checkException(command);
if (command.getResult() == null) {
throw new MemcachedException(
"Operation fail,may be caused by networking or timeout");
}
final Object result = command.getResult();
if (result instanceof String) {
if (((String) result).equals("NOT_FOUND")) {
if (this.add(key, exp, String.valueOf(initValue),
this.opTimeout)) {
return initValue;
} else {
return this.sendIncrOrDecrCommand(key, delta,
initValue, cmdType, noreply, operationTimeout,
exp);
}
} else {
throw new MemcachedException(
"Unknown result type for incr/decr:"
+ result.getClass() + ",result=" + result);
}
} else {
return (Long) command.getResult();