void advanceCommitIndex() throws InterruptedException {
  Map<Integer,Peer> peers=this.peers;
  Arrays.fill(matchIndices,0);
  final int[] ix={0};
  peers.forEach(null);
  for (int i=0; i < matchIndices.length; i++) {
    for (int j=1; j < matchIndices.length - i; j++) {
      if (matchIndices[j - 1] < matchIndices[j]) {
        int temp=matchIndices[j - 1];
        matchIndices[j - 1]=matchIndices[j];
        matchIndices[j]=temp;
      }
    }
  }
  saveQueue.getLatest(savedRid);
  int newCommitIndex=Math.min(savedRid.index,matchIndices[matchIndices.length - majority]);
  if (newCommitIndex > commitIndex) {
    commitIndex=newCommitIndex;
  }
}

void advanceCommitIndex ( ) throws InterruptedException { Map < Integer , Peer > peers = this . peers ; Arrays . fill ( matchIndices , 0 ) ; final int [ ] ix = { 0 } ; peers . forEach ( null ) ; for ( int i = 0 ; i < matchIndices . length ; i ++ ) { for ( int j = 1 ; j < matchIndices . length - i ; j ++ ) { if ( matchIndices [ j - 1 ] < matchIndices [ j ] ) { int temp = matchIndices [ j - 1 ] ; matchIndices [ j - 1 ] = matchIndices [ j ] ; matchIndices [ j ] = temp ; } } } saveQueue . getLatest ( savedRid ) ; int newCommitIndex = Math . min ( savedRid . index , matchIndices [ matchIndices . length - majority ] ) ; if ( newCommitIndex > commitIndex ) { commitIndex = newCommitIndex ; } }
computes the commit index based on the save index and match indices from all the peers . todo : do not advance unless the latest commited entry ' s term matches the current term .
