Delta addOrCombineDelta(TransactionStatus status, Accumulator accumulator, int step, long value) {
// Check current deltas, no lock as status is single txn/thread
Delta delta = status.getDelta();
while (delta != null) {
if (delta.canMerge(accumulator, step)) {
delta.merge(value);
return null;
}
delta = delta.getNext();
}
// No compatible existing delta, create a new one