Runtime-side timeout

RuntimeConfig.builder().toolTimeout(Duration.ofSeconds(10)).build();
Advertisement

Interrupt-based cancellation

The runtime interrupts the thread. Long-running tools should check Thread.interrupted() periodically or use interrupt-aware I/O.

Advertisement

Cleanup on cancellation

Try-with-resources handles most cases. For manual cleanup, wrap in try/finally.