Why I can search the same process instance by runtimeService and historyService at same time?


I have two process instance and thats not been ended. But i can search them by runtimeService and historyService. At the before I think just the ended process instance can searched by the hisotryService. I am wrong or the camunda wrong?

Here is my code

   public ResponseEntity<Map<String, Object>> getRecords(PageAndSize pageAndSize) {
        User user = userService.getCurrentUser();
        List<ProcessInstance> instances = runtimeService.

        List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery()

        List<String> ids = instances.stream().map(Execution::getId).collect(Collectors.toList());
        List<ProjectApplicationRecord2VO> voList = toVO(ids, false);
        Page page = PageableUtil.getPage(pageAndSize, voList);
        return new ResponseEntity<>(PageableUtil.resolvePage(page), HttpStatus.OK);

And here is the process instances

Please help me. Thanks you all.


Is the historyService can both search the running and finished process instances ?


Think of it like this: stunning instance waiting in a task already has a history as well, at least one start event has been passed already , and this is logged by the history service.

So running instanced ca be found by runtime and history service.
Ended instances only by history service.


Thank you for your answer.