void log(int op, Object el) { LogEntry entry = new LogEntry(); entry.op = op; entry.el = el; List<LogEntry> log = txManager.getContext().getCurrent().getTopLevel().getAttribute(S); if (log == null) { log = new ArrayList<LogEntry>(); txManager.getContext().getCurrent().getTopLevel().setAttribute(S, log); } log.add(entry); }
HGSortedSet<E> write() { List<LogEntry> log = txManager.getContext().getCurrent().getTopLevel().getAttribute(S); if (log == null) // should we copy-on-write? { HGSortedSet<E> readOnly = S.get(); // S.getForWrite(); HGSortedSet<E> writeable = cloneSet(readOnly); S.put(writeable); } return S.get(); }