code: public void addListener(TransactionableResourceManagerListener listener)
     {
        TransactionContext ctx = contexts.get();
        if (ctx == null)
        {
           throw new IllegalStateException("There is no active transaction context");
        }
        XidContext xidCtx = ctx.getXidContext();
        if (xidCtx == null)
        {
           throw new IllegalStateException("There is no active xid context");
        }
        xidCtx.addListener(listener);
     }
docs: Add a new listener to register to the current tx
  @param listener the listener to add