public Transaction enter ( IsolationLevel level ) { mLock . lock ( ) ; try { TransactionImpl < Txn > parent = mActive ; IsolationLevel actualLevel = mTxnMgr . selectIsolationLevel ( parent , level ) ; if ( actualLevel == null ) { if ( parent == null ) { throw new UnsupportedOperationException ( "Desired isolation level not supported: " + level ) ; } else { throw new UnsupportedOperationException ( "Desired isolation level not supported: " + level + "; parent isolation level: " + parent . getIsolationLevel ( ) ) ; } } TransactionImpl < Txn > txn = new TransactionImpl < Txn > ( this , parent , false , actualLevel ) ; mActive = txn ; mTxnMgr . entered ( txn , parent ) ; return txn ; } finally { mLock . unlock ( ) ; } }
Enters a new transaction scope which becomes the active transaction .