enso/engine/runtime-instrument-common/src
Hubert Plociniczak 35e5ed53d2
Don't cancel aborted jobs immediately (#11375)
* Don't cancel aborted jobs immediately

Rather than cancelling Futures that capture jobs' logic,
this change introduces a two-level system:

- interrupt all jobs softly via ThreadInterrupted at safepoints
- if safepoint is not executed within some time period or it is
  but the job is still not cancelled, trigger a hard-interrupt
  by cancelling the job explicitly, if possible

Closes #11084.

* Only cancel Future when you mean it

Soft-cancelling a future only to later call it with `mayInterrupt` set
to `true` has no effect in the latter case.
Changed the logic so that interrupting a Future will really enforce it.

Ocassionally some commands should not attempt to run soft cancellations
- we know they will re-execute the program.

* Replace Thread.sleep with Future.get

No while loops etc, it's much easier to reason about what is soft and
hard interrupt supposed to do.

* Better comments/logs

* nit

* PR review

* Make test more robust
2024-11-05 10:33:02 +01:00
..
bench/java/org/enso/interpreter/instrument Separating instrument related files into runtime-instrument-common project (#6992) 2023-06-08 16:51:50 +02:00
main Don't cancel aborted jobs immediately (#11375) 2024-11-05 10:33:02 +01:00
test Don't cancel aborted jobs immediately (#11375) 2024-11-05 10:33:02 +01:00