code: public int prepare(Xid xid) throws XAException
      {
          if (tc.isEntryEnabled()) Tr.entry(tc, "prepare", xid);
  
  		final JCATranWrapper txWrapper;
  
  		try
  		{
  			validateXid(xid);
  
  			// Get the wrapper adding an association in the process
  			txWrapper = getTxWrapper(xid, true);
  		}
  		catch(XAException e)
  		{
  			if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] {"caught XAException", e});
  			throw e;
  		}
  
  		final int result;
  		
  		try
  		{
  			result = txWrapper.prepare(this);
  		}
  		catch (XAException e)
  		{
  			TxExecutionContextHandler.removeAssociation(txWrapper);
  
  			if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", new Object[] {"prepare threw XAException", e});
  			throw e;
  		}
  
  		TxExecutionContextHandler.removeAssociation(txWrapper);
  
  		if (tc.isEntryEnabled()) Tr.exit(tc, "prepare", result);
  		return result;
      }
docs: /* (non-Javadoc)
  @see javax.resource.spi.XATerminator#prepare(javax.transaction.xa.Xid)