code: public void applyAll(long index) {
      if (!log.isOpen())
        return;
  
      // If the effective commit index is greater than the last index applied to the state machine then apply remaining entries.
      long lastIndex = Math.min(index, log.lastIndex());
      if (lastIndex > lastApplied) {
        for (long i = lastApplied + 1; i <= lastIndex; i++) {
          Entry entry = log.get(i);
          if (entry != null) {
            apply(entry).whenComplete((result, error) -> entry.release());
          }
          setLastApplied(i);
        }
      }
    }
docs: Applies all commits up to the given index.
  <p>
  Calls to this method are assumed not to expect a result. This allows some optimizations to be
  made internally since linearizable events don't have to be waited to complete the command.
  
  @param index The index up to which to apply commits.