@Override public TxnType transactionType() { checkNotClosed() ; if ( ! isInTransaction() ) return null; return dsgtxn.get().getTransaction().getTxnType(); }
@Override public ReadWrite transactionMode() { checkNotClosed() ; if ( ! isInTransaction() ) return null; return dsgtxn.get().getTransaction().getTxnMode(); }
@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() + ")") ; }
@Override public String toString() { try { if ( isInTransaction() ) // Risky ... return get().toString() ; // Hence ... return getBaseDatasetGraph().toString() ; } catch (Throwable th) { return "DatasetGraphTransaction" ; } }
/** Get the current DatasetGraphTDB */ @Override public DatasetGraphTDB get() { if ( isInTransaction() ) { DatasetGraphTxn dsgTxn = dsgtxn.get() ; if ( dsgTxn == null ) throw new TDBTransactionException("In a transaction but no transactional DatasetGraph") ; return dsgTxn.getView() ; } if ( sConn.haveUsedInTransaction() ) throw new TDBTransactionException("Not in a transaction") ; // Never been used in a transaction - return underlying database for old // style (non-transactional) usage. return sConn.getBaseDataset() ; }
@Override protected synchronized void _close() { if ( isClosed ) return ; if ( sConn.haveUsedInTransaction() ) { if ( isInTransaction() ) { TDB.logInfo.warn("Attempt to close a DatasetGraphTransaction while a transaction is active - ignored close (" + getLocation() + ")") ; return ; } // Otherwise ignore - close() while transactional is meaningless. return ; } synchronized(this) { if ( ! sConn.isValid() ) { // There may be another DatasetGraphTransaction using this location // and that DatasetGraphTransaction has been closed, invalidating // the StoreConnection. return ; } DatasetGraphTDB dsg = sConn.getBaseDataset() ; dsg.sync() ; dsg.close() ; StoreConnection.release(getLocation()) ; dsgtxn.remove() ; inTransaction.remove() ; isClosed = true ; return ; } }
@Override public DatasetGraph getW() { if ( isInTransaction() ) { DatasetGraphTxn dsgTxn = dsgtxn.get() ; if ( dsgTxn.getTransaction().isRead() ) {