public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable {
return visitor.visitReplaceCommand(ctx, this);
}
public Object perform(InvocationContext ctx) throws Throwable {
MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key);
if (e != null) {
if (ctx.isOriginLocal()) {
//ISPN-514
if (e.isNull() || e.getValue() == null) return returnValue(null, false);
if (oldValue == null || oldValue.equals(e.getValue())) {
Object old = e.setValue(newValue);
e.setLifespan(lifespanMillis);
e.setMaxIdle(maxIdleTimeMillis);
return returnValue(old, true);
}
return returnValue(null, false);
} else {
// for remotely originating calls, this doesn't check the status of what is under the key at the moment
Object old = e.setValue(newValue);
e.setLifespan(lifespanMillis);
e.setMaxIdle(maxIdleTimeMillis);
return returnValue(old, true);
}
}
return returnValue(null, false);