### Question:
TransactionPropagator implements Lifecycle { public int committed( long txId, int authorId ) { int replicationFactor = desiredReplicationFactor; boolean isAuthoredBySlave = config.getServerId().toIntegerIndex() != authorId; if ( isAuthoredBySlave ) { replicationFactor--; } if ( replicationFactor == 0 ) { return replicationFactor; } Collection<ReplicationContext> committers = new HashSet<>(); try { int successfulReplications = 0; Iterator<Slave> slaveList = filter( replicationStrategy.prioritize( slaves.getSlaves() ).iterator(), authorId ); CompletionNotifier notifier = new CompletionNotifier(); for ( int i = 0; i < replicationFactor && slaveList.hasNext(); i++ ) { Slave slave = slaveList.next(); Callable<Void> slaveCommitter = slaveCommitter( slave, txId, notifier ); committers.add( new ReplicationContext( slaveCommitters.submit( slaveCommitter ), slave ) ); } Collection<ReplicationContext> toAdd = new ArrayList<>(); Collection<ReplicationContext> toRemove = new ArrayList<>(); while ( !committers.isEmpty() && successfulReplications < replicationFactor ) { toAdd.clear(); toRemove.clear(); for ( ReplicationContext context : committers ) { if ( !context.future.isDone() ) { continue; } if ( isSuccessful( context ) ) { successfulReplications++; } else if ( slaveList.hasNext() ) { Slave newSlave = slaveList.next(); Callable<Void> slaveCommitter; try { slaveCommitter = slaveCommitter( newSlave, txId, notifier ); } catch ( Throwable t ) { log.error( "Unknown error commit master transaction at slave", t ); return desiredReplicationFactor ; } toAdd.add( new ReplicationContext( slaveCommitters.submit( slaveCommitter ), newSlave ) ); } toRemove.add( context ); } if ( !toAdd.isEmpty() ) { committers.addAll( toAdd ); } if ( !toRemove.isEmpty() ) { committers.removeAll( toRemove ); } if ( !committers.isEmpty() ) { notifier.waitForAnyCompletion(); } } if ( successfulReplications < replicationFactor ) { pushedToTooFewSlaveLogger .info( "Transaction " + txId + " couldn't commit on enough slaves, desired " + replicationFactor + ", but could only commit at " + successfulReplications ); } return replicationFactor - successfulReplications; } finally { for ( ReplicationContext committer : committers ) { committer.future.cancel( false ); } } } TransactionPropagator( Configuration config, Log log, Slaves slaves, CommitPusher pusher ); static Configuration from( final Config config ); static Configuration from( final Config config, final SlavePriority slavePriority ); @Override void init(); @Override void start(); @Override void stop(); @Override void shutdown(); int committed( long txId, int authorId );  }### Answer:
@Test public void shouldCapUndesiredSlaveCountPushLogging() { int serverId = 1; final InstanceId instanceId = new InstanceId( serverId ); Configuration config = new Configuration() { @Override public int getTxPushFactor() { return 1; } @Override public InstanceId getServerId() { return instanceId; } @Override public SlavePriority getReplicationStrategy() { return SlavePriorities.fixedDescending(); } }; Log logger = mock( Log.class ); Slaves slaves = mock( Slaves.class ); when( slaves.getSlaves() ).thenReturn( Collections.emptyList() ); CommitPusher pusher = mock( CommitPusher.class ); TransactionPropagator propagator = life.add( new TransactionPropagator( config, logger, slaves, pusher ) ); for ( int i = 0; i < 10; i++ ) { propagator.committed( TransactionIdStore.BASE_TX_ID, serverId ); } verify( logger, times( 1 ) ).info( anyString() ); }