use of com.persistit.Transaction in project titan by thinkaurelius.
the class PersistitTransaction method commit.
@Override
public void commit() throws StorageException {
synchronized (this) {
if (null == sessionId) {
// Already closed
log.warn("Can't commit {}: already closed, trace to redundant commit follows", this, new IllegalStateException("redundant commit"));
return;
}
super.commit();
assign();
Transaction tx = db.getTransaction();
int retries = 3;
try {
if (tx.isActive() && !tx.isRollbackPending()) {
int i = 0;
while (true) {
try {
tx.commit(Transaction.CommitPolicy.HARD);
tx.end();
break;
} catch (RollbackException ex) {
if (i++ >= retries) {
throw ex;
}
}
}
close();
}
} catch (PersistitException ex) {
throw new PermanentStorageException(ex);
}
}
}
use of com.persistit.Transaction in project titan by thinkaurelius.
the class PersistitTransaction method rollback.
@Override
public void rollback() throws StorageException {
super.rollback();
synchronized (this) {
assign();
Transaction tx = db.getTransaction();
if (tx.isActive() && !tx.isCommitted()) {
tx.rollback();
}
tx.end();
close();
}
}
Aggregations