code: @Override
    public Xid[] recover(int flags) throws XAException {
      synchronized (cpoXaStateMap) {
        switch (flags) {
          case TMSTARTRSCAN:
          case TMENDRSCAN:
          case TMSTARTRSCAN | TMENDRSCAN:
          case TMNOFLAGS:
            ArrayList<Xid> xids = new ArrayList<>();
  
            for (CpoXaState<T> cpoXaState : cpoXaStateMap.getXidStateMap().values()) {
              if (cpoXaState.isPrepared())
                xids.add(cpoXaState.getXid());
            }
            return xids.toArray(new Xid[0]);
          default:
            throw CpoXaError.createXAException(CpoXaError.XAER_INVAL, "Invalid flag for recover()");
        }
      }
    }
docs: Obtains a list of prepared transaction branches from a resource manager. The transaction manager calls this method during recovery to obtain the
  list of transaction branches that are currently in prepared or heuristically completed states.
  
  @param flags - One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must be used when no other flags are set in the parameter.
  @return - The resource manager returns zero or more XIDs of the transaction branches that are currently in a prepared or heuristically completed state.
  If an error occurs during the operation, the resource manager should throw the appropriate XAException.
  @throws XAException - An error has occurred. Possible values are XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.