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;
}

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 ; }
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 .
