docs: private void applyQuery(long timestamp, RaftSession session, PrimitiveOperation operation, CompletableFuture<OperationResult> future) {
      // If the service has been deleted then throw an unknown service exception.
      if (deleted) {
        log.warn("Service {} has been deleted by another process", serviceName);
        future.completeExceptionally(new RaftException.UnknownService("Service " + serviceName + " has been deleted"));
        return;
      }
  
      // If the session is not open, fail the request.
      if (!session.getState().active()) {
        log.warn("Inactive session: " + session.sessionId());
        future.completeExceptionally(new RaftException.UnknownSession("Unknown session: " + session.sessionId()));
        return;
      }
  
      // Set the current operation type to QUERY to prevent events from being sent to clients.
      setOperation(OperationType.QUERY);
  
      Commit<byte[]> commit = new DefaultCommit<>(currentIndex, operation.id(), operation.value(), session, timestamp);
  
      long eventIndex = session.getEventIndex();
  
      OperationResult result;
      try {
        currentSession = session;
        result = OperationResult.succeeded(currentIndex, eventIndex, service.apply(commit));
      } catch (Exception e) {
        result = OperationResult.failed(currentIndex, eventIndex, e);
      } finally {
        currentSession = null;
      }
      future.complete(result);
    }