protected List<TransactionParticipant> getParticipants (long id) { // Use a local copy of participant to avoid adding the // GROUP participant to the DEFAULT_GROUP List<TransactionParticipant> participantsChain = new ArrayList(); List<TransactionParticipant> participants = getParticipants (DEFAULT_GROUP); // Add DEFAULT_GROUP participants participantsChain.addAll(participants); String key = getKey(GROUPS, id); String grp; // now add participants of Group while ( (grp = (String) psp.inp (key)) != null) { participantsChain.addAll (getParticipants (grp)); } return participantsChain; }
@Test public void testGetParticipantsThrowsNullPointerException() throws Throwable { try { transactionManager.getParticipants("testTransactionManagerGroupName"); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); assertNull("transactionManager.groups", transactionManager.groups); } }
protected void recover (int session, long id) { LogEvent evt = getLog().createLogEvent ("recover"); Profiler prof = new Profiler(); evt.addMessage ("<id>" + id + "</id>"); try { String stateKey = getKey (STATE, id); String contextKey = getKey (CONTEXT, id); Integer state = (Integer) psp.rdp (stateKey); if (state == null) { evt.addMessage ("unknown stateKey " + stateKey); SpaceUtil.wipe (psp, contextKey); // just in case ... return; } Serializable context = (Serializable) psp.rdp (contextKey); if (context != null) evt.addMessage (context); if (DONE.equals (state)) { evt.addMessage ("<done/>"); } else if (COMMITTING.equals (state)) { commit (session, id, context, getParticipants (id), true, evt, prof); } else if (PREPARING.equals (state)) { abort (session, id, context, getParticipants (id), true, evt, prof); } purge (id, true); } finally { evt.addMessage (prof); Logger.log (evt); } } protected synchronized void checkRetryTask () {
String grp = st.nextToken(); addGroup (id, grp); participants.addAll (getParticipants (grp));
id = nextId (); members = new ArrayList (); iter = getParticipants (DEFAULT_GROUP).iterator(); activeTransactions.incrementAndGet();