public synchronized NodeId commit(NodeImpl newRoot) {
addNode(newRoot, false);
try {
final NodeMap map = this;
final ArrayList<Long> list = new ArrayList<Long>();
newRoot.visit(new ChildVisitor() {
public void accept(NodeId childId) {
if (childId.getLong() < 0) {
NodeImpl t = temp.get(childId.getLong());
t.visit(this);
list.add(childId.getLong());