@Override public boolean isInTransaction() { checkNotClosed() ; return inTransaction.get() ; }
/** Access the base storage - use with care */ public DatasetGraphTDB getBaseDatasetGraph() { checkNotClosed() ; return sConn.getBaseDataset() ; }
@Override protected void _abort() { checkNotClosed() ; dsgtxn.get().abort() ; inTransaction.set(false) ; }
@Override protected void _begin(TxnType txnType) { checkNotClosed() ; DatasetGraphTxn dsgTxn = sConn.begin(txnType) ; dsgtxn.set(dsgTxn) ; inTransaction.set(true) ; }
@Override protected void _commit() { checkNotClosed() ; dsgtxn.get().commit() ; inTransaction.set(false) ; }
public DatasetGraphTDB getDatasetGraphToQuery() { checkNotClosed() ; return get() ; }
@Override protected void _end() { checkNotClosed() ; DatasetGraphTxn dsg = dsgtxn.get() ; // It's null if end() already called. if ( dsg == null ) { TDB.logInfo.warn("Transaction already ended") ; return ; } try { // begin(W)..end() throws an exception. dsgtxn.get().end() ; } finally { // May already be false due to .commit/.abort. inTransaction.set(false) ; dsgtxn.set(null) ; } }
@Override public ReadWrite transactionMode() { checkNotClosed() ; if ( ! isInTransaction() ) return null; return dsgtxn.get().getTransaction().getTxnMode(); }
@Override public TxnType transactionType() { checkNotClosed() ; if ( ! isInTransaction() ) return null; return dsgtxn.get().getTransaction().getTxnType(); }
@Override protected boolean _promote(Promote promoteMode) { // Promotion (TDB1) is a reset of the DatasetGraphTxn. checkNotClosed() ; DatasetGraphTxn dsgTxn = dsgtxn.get(); Transaction transaction = dsgTxn.getTransaction(); DatasetGraphTxn dsgTxn2 = transaction.getTxnMgr().promote(dsgTxn, transaction.getTxnType(), promoteMode); if ( dsgTxn2 == null ) return false; dsgtxn.set(dsgTxn2) ; return true; }
@Override protected void checkActive() { checkNotClosed() ; if ( !isInTransaction() ) throw new JenaTransactionException("Not in a transaction (" + getLocation() + ")") ; }
@Override protected void checkNotActive() { checkNotClosed() ; if ( sConn.haveUsedInTransaction() && isInTransaction() ) throw new JenaTransactionException("Currently in a transaction (" + getLocation() + ")") ; }