Search in sources :

Example 1 with WrappedTransaction

use of com.syncleus.ferma.WrappedTransaction in project open-kilda by telstra.

the class FermaTransactionAdapter method closeForeignTransactionIfExist.

private void closeForeignTransactionIfExist() throws Exception {
    DelegatingFramedGraph<?> graph = getContextExtension().getGraphCreateIfMissing();
    WrappedTransaction currentTx = graph.tx();
    if (currentTx.isOpen()) {
        log.debug("Closing an existing underlying transaction {} on graph {}", currentTx, graph);
        commitOrRollback(currentTx, false);
    }
}
Also used : WrappedTransaction(com.syncleus.ferma.WrappedTransaction)

Example 2 with WrappedTransaction

use of com.syncleus.ferma.WrappedTransaction in project open-kilda by telstra.

the class FermaTransactionAdapter method open.

@Override
public void open() throws Exception {
    try {
        closeForeignTransactionIfExist();
    } catch (PersistenceException e) {
        throw e;
    } catch (Exception e) {
        throw wrapException(e);
    }
    DelegatingFramedGraph<?> graph = getContextExtension().getGraphCreateIfMissing();
    WrappedTransaction transaction = graph.tx();
    if (transaction.isOpen()) {
        throw new PersistenceException("Attempt to reopen transaction: " + transaction);
    }
    log.debug("Opening a new transaction {} on graph {}", transaction, graph);
    transaction.open();
}
Also used : PersistenceException(org.openkilda.persistence.exceptions.PersistenceException) WrappedTransaction(com.syncleus.ferma.WrappedTransaction) PersistenceException(org.openkilda.persistence.exceptions.PersistenceException)

Aggregations

WrappedTransaction (com.syncleus.ferma.WrappedTransaction)2 PersistenceException (org.openkilda.persistence.exceptions.PersistenceException)1