private void clearDatabase(SimpleXARecoveryHandler[] handlers) throws SimpleXAResourceException { try { for (SimpleXARecoveryHandler handler: handlers) handler.clear(); } catch (IOException ei) { throw new SimpleXAResourceException("IO failure clearing database", ei); } }
private void selectCommonPhase(int phaseNumber, SimpleXARecoveryHandler[] handlers) throws SimpleXAResourceException { try { for (SimpleXARecoveryHandler handler: handlers) handler.selectPhase(phaseNumber); } catch (IOException ei) { throw new SimpleXAResourceException("IO failure selecting phase on database", ei); } }
private TIntHashSet[] recoverRecoveryHandlers(SimpleXARecoveryHandler[] handlers) throws SimpleXAResourceException { TIntHashSet[] phaseSets = new TIntHashSet[handlers.length]; boolean allEmpty = true; for (int i = 0; i < handlers.length; i++) { phaseSets[i] = new TIntHashSet(handlers[i].recover()); if (!allEmpty && phaseSets[i].isEmpty()) { throw new SimpleXAResourceException("Unable to find common phase in pre-existing database"); } else if (!phaseSets[i].isEmpty()) { allEmpty = false; } } return !allEmpty ? phaseSets : null; }