private void throwCannotCommitExceptionIfNeeded(ParticipantHandle[] phs) throws CannotCommitException { Map<Integer, Exception> participantsExceptions = new HashMap<Integer, Exception>(); for (ParticipantHandle ph : phs) { if (ph.getCommitException() != null) { participantsExceptions.put(ph.getPartionId(), ph.getCommitException()); } } if (!participantsExceptions.isEmpty()) { throw new CannotCommitDistributedException("some participants failed in commit after prepare [ID=" + getTransaction().id +"]: - risk of partial transaction", participantsExceptions); } }