Introduce 'Termination' interface for termination request checking in libraries
We currently use both BooleanSupplier
, which has an ugly getAsBoolean
method, and Supplier<Boolean>
, which allows null
. The idea is to:
- Introduce a
Termination
functional interface in thecommon.java
plugin. - Document the cooperative termination concept in the interface's JavaDoc.
- The interface has one method,
isRequested
that returns aboolean
. - Add
public static final Termination NEVER = () -> false;
.
See also this discussion: !989 (comment 2548515).