@Override public Xid[] recover(int flag) throws XAException {
  debugCodeCall("recover",quoteFlags(flag));
  checkOpen();
  try (Statement stat=physicalConn.createStatement()){
    ResultSet rs=stat.executeQuery("SELECT * FROM " + "INFORMATION_SCHEMA.IN_DOUBT ORDER BY TRANSACTION");
    ArrayList<Xid> list=New.arrayList();
    while (rs.next()) {
      String tid=rs.getString("TRANSACTION");
      int id=getNextId(XID);
      Xid xid=new JdbcXid(factory,id,tid);
      list.add(xid);
    }
    rs.close();
    Xid[] result=new Xid[list.size()];
    list.toArray(result);
    if (list.size() > 0) {
      prepared=true;
    }
    return result;
  }
 catch (  SQLException e) {
    XAException xa=new XAException(XAException.XAER_RMERR);
    xa.initCause(e);
    throw xa;
  }
}

@ Override public Xid [ ] recover ( int flag ) throws XAException { debugCodeCall ( "recover" , quoteFlags ( flag ) ) ; checkOpen ( ) ; try ( Statement stat = physicalConn . createStatement ( ) ) { ResultSet rs = stat . executeQuery ( "SELECT * FROM " + "INFORMATION_SCHEMA.IN_DOUBT ORDER BY TRANSACTION" ) ; ArrayList < Xid > list = New . arrayList ( ) ; while ( rs . next ( ) ) { String tid = rs . getString ( "TRANSACTION" ) ; int id = getNextId ( XID ) ; Xid xid = new JdbcXid ( factory , id , tid ) ; list . add ( xid ) ; } rs . close ( ) ; Xid [ ] result = new Xid [ list . size ( ) ] ; list . toArray ( result ) ; if ( list . size ( ) > 0 ) { prepared = true ; } return result ; } catch ( SQLException e ) { XAException xa = new XAException ( XAException . XAER_RMERR ) ; xa . initCause ( e ) ; throw xa ; } }
get the list of prepared transaction branches . this method is called by the transaction manager during recovery .
