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
Terminationfunctional interface in thecommon.javaplugin. - Document the cooperative termination concept in the interface's JavaDoc.
- The interface has one method,
isRequestedthat returns aboolean. - Add
public static final Termination NEVER = () -> false;.
See also this discussion: !989 (comment 2548515).