@Test public void test_fanout_to_all() throws Exception { participants.fanOutTransactionPrimitive(id, "tx_commit"); verify(part1).onRPC(eq("tx_rpc"), any(ArrayList.class)); ArgumentCaptor<ArrayList> argumentCaptor = ArgumentCaptor.forClass(ArrayList.class); verify(part2).onRPC(eq("tx_rpc"), argumentCaptor.capture()); ArrayList<Object> params = argumentCaptor.getValue(); TransactionWrapper tx = new TransactionWrapper("tx_rpc", params); assertEquals("tx_commit", tx.getInnerRPCMethod()); }
public void fanOutTransactionPrimitive(UUID transactionId, String primitiveMethod) throws TransactionExecutionException { ArrayList<Object> paramsTX = TransactionWrapper.getTransactionRPCParams(transactionId, primitiveMethod, null); TransactionContext.enterTransaction( transactionId, this.getParticipantManager(transactionId)); try { for (ClientPolicy p : this.getParticipants(transactionId)) { if (TransactionContext.getProcessedClients().contains(p)) { continue; } TransactionContext.getProcessedClients().add(p); try { p.onRPC(TransactionWrapper.txWrapperTag, paramsTX); } catch (Exception e) { throw new TransactionExecutionException( "2PC transaction exception: " + primitiveMethod, e); } } } finally { TransactionContext.leaveTransaction(); } }
TwoPCLocalParticipants implements Serializable { public void fanOutTransactionPrimitive(UUID transactionId, String primitiveMethod) throws TransactionExecutionException { ArrayList<Object> paramsTX = TransactionWrapper.getTransactionRPCParams(transactionId, primitiveMethod, null); TransactionContext.enterTransaction( transactionId, this.getParticipantManager(transactionId)); try { for (ClientPolicy p : this.getParticipants(transactionId)) { if (TransactionContext.getProcessedClients().contains(p)) { continue; } TransactionContext.getProcessedClients().add(p); try { p.onRPC(TransactionWrapper.txWrapperTag, paramsTX); } catch (Exception e) { throw new TransactionExecutionException( "2PC transaction exception: " + primitiveMethod, e); } } } finally { TransactionContext.leaveTransaction(); } } }
TwoPCLocalParticipants implements Serializable { public void fanOutTransactionPrimitive(UUID transactionId, String primitiveMethod) throws TransactionExecutionException { ArrayList<Object> paramsTX = TransactionWrapper.getTransactionRPCParams(transactionId, primitiveMethod, null); TransactionContext.enterTransaction( transactionId, this.getParticipantManager(transactionId)); try { for (ClientPolicy p : this.getParticipants(transactionId)) { if (TransactionContext.getProcessedClients().contains(p)) { continue; } TransactionContext.getProcessedClients().add(p); try { p.onRPC(TransactionWrapper.txWrapperTag, paramsTX); } catch (Exception e) { throw new TransactionExecutionException( "2PC transaction exception: " + primitiveMethod, e); } } } finally { TransactionContext.leaveTransaction(); } }  }
TwoPCLocalParticipants implements Serializable { public void fanOutTransactionPrimitive(UUID transactionId, String primitiveMethod) throws TransactionExecutionException { ArrayList<Object> paramsTX = TransactionWrapper.getTransactionRPCParams(transactionId, primitiveMethod, null); TransactionContext.enterTransaction( transactionId, this.getParticipantManager(transactionId)); try { for (ClientPolicy p : this.getParticipants(transactionId)) { if (TransactionContext.getProcessedClients().contains(p)) { continue; } TransactionContext.getProcessedClients().add(p); try { p.onRPC(TransactionWrapper.txWrapperTag, paramsTX); } catch (Exception e) { throw new TransactionExecutionException( "2PC transaction exception: " + primitiveMethod, e); } } } finally { TransactionContext.leaveTransaction(); } }  TwoPCParticipants getParticipantManager(UUID transactionId); Collection<ClientPolicy> getParticipants(UUID transactionId); void addParticipants(UUID transactionId, Collection<ClientPolicy> participants); void cleanup(UUID transactionId); void fanOutTransactionPrimitive(UUID transactionId, String primitiveMethod); Boolean allParticipantsVotedYes(UUID transactionId); }
TwoPCLocalParticipants implements Serializable { public void fanOutTransactionPrimitive(UUID transactionId, String primitiveMethod) throws TransactionExecutionException { ArrayList<Object> paramsTX = TransactionWrapper.getTransactionRPCParams(transactionId, primitiveMethod, null); TransactionContext.enterTransaction( transactionId, this.getParticipantManager(transactionId)); try { for (ClientPolicy p : this.getParticipants(transactionId)) { if (TransactionContext.getProcessedClients().contains(p)) { continue; } TransactionContext.getProcessedClients().add(p); try { p.onRPC(TransactionWrapper.txWrapperTag, paramsTX); } catch (Exception e) { throw new TransactionExecutionException( "2PC transaction exception: " + primitiveMethod, e); } } } finally { TransactionContext.leaveTransaction(); } }  TwoPCParticipants getParticipantManager(UUID transactionId); Collection<ClientPolicy> getParticipants(UUID transactionId); void addParticipants(UUID transactionId, Collection<ClientPolicy> participants); void cleanup(UUID transactionId); void fanOutTransactionPrimitive(UUID transactionId, String primitiveMethod); Boolean allParticipantsVotedYes(UUID transactionId);  }