try {
latch.await(); // synchronize ...
tm().begin();
print("Began txn1");
db.lock(key);
EditableDocument editor = db.editContent(key, true);
editor.setNumber("k2", 3); // update an existing field
print(editor);
print("Committing txn1");
tm().commit();
} catch (Exception e) {
log.error("Unexpected error performing transaction", e);
}
}
}, false);
Thread t2 = fork(new Runnable() {
@SuppressWarnings( "synthetic-access" )
@Override
public void run() {
try {
latch.await(); // synchronize ...
tm().begin();
print("Began txn2");
db.lock(key);
EditableDocument editor = db.editContent(key, true);
editor.setNumber("k3", 3); // add a new field
print(editor);
print("Committing txn2");
tm().commit();
} catch (Exception e) {
log.error("Unexpected error performing transaction", e);