code: @SuppressWarnings("unchecked")
    void commit() {
      // Execute any tasks that were queue during execution of the command.
      if (!tasks.isEmpty()) {
        for (ServerTask task : tasks) {
          context.update(context.index(), context.clock().instant(), ServerStateMachineContext.Type.COMMAND);
          try {
            task.future.complete(task.callback.get());
          } catch (Exception e) {
            task.future.completeExceptionally(e);
          }
        }
        tasks.clear();
      }
      context.commit();
    }
docs: Commits the application of a command to the state machine.