public TransactionScope < Txn > localScope ( ) { TransactionScope < Txn > scope = mLocalScope . get ( ) ; if ( scope == null ) { int state ; synchronized ( this ) { state = mState ; scope = new TransactionScope < Txn > ( this , state != OPEN ) ; mAllScopes . put ( scope , null ) ; } mLocalScope . set ( scope ) ; if ( state == SUSPENDED ) { // Immediately suspend new scope. scope . getLock ( ) . lock ( ) ; } } return scope ; }
Returns the thread - local TransactionScope creating it if needed .