question: public TXStateProxy masqueradeAs ( TransactionMessage msg ) throws InterruptedException { if ( msg . getTXUniqId ( ) == NOTX || ! msg . canParticipateInTransaction ( ) ) { return null ; } TXId key = new TXId ( msg . getMemberToMasqueradeAs ( ) , msg . getTXUniqId ( ) ) ; TXStateProxy val = getOrSetHostedTXState ( key , msg ) ; if ( val != null ) { boolean success = getLock ( val , key ) ; while ( ! success ) { val = getOrSetHostedTXState ( key , msg ) ; if ( val != null ) { success = getLock ( val , key ) ; } else { break ; } } } setTXState ( val ) ; return val ; }
target:  Associate the remote txState with the thread processing this message. Also, we acquire a lock on the txState, on which this thread operates. Some messages like SizeMessage should not create a new txState.