docs: public void invalidateFuturesFrom(long entryIndex) {
          int count = 0;
          Iterator<Entry<Long, SimpleCompletableFuture>> iterator = futures.entrySet().iterator();
          while (iterator.hasNext()) {
              Entry<Long, SimpleCompletableFuture> entry = iterator.next();
              long index = entry.getKey();
              if (index >= entryIndex) {
                  entry.getValue().setResult(new LeaderDemotedException(localMember, state.leader()));
                  iterator.remove();
                  count++;
              }
          }
  
          if (count > 0) {
              logger.warning("Invalidated " + count + " futures from log index: " + entryIndex);
          }
      }