@Override public VBoxBody<HGSortedSet<E>> commit( HGTransaction tx, HGSortedSet<E> newvalue, long txNumber) { if (tx != null) { HGSortedSet<E> lastCommitted = getLastCommitted(tx); List<LogEntry> log = tx.getTopLevel().getAttribute(this); if (log != null) // did we do any modifications to the set? { lastCommitted = thisSet.cloneSet(lastCommitted); thisSet.applyLog(log, lastCommitted); return super.commit(tx, lastCommitted, txNumber); } else return body; // nothing to do, we've just been reading } else { return super.commit(tx, newvalue, txNumber); // hope caller knows what they are doing } }
HGSortedSet<E> getLastCommitted(HGTransaction tx) { return body.getBody(tx.getNumber()).value; }