Skip to content

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 the common.java plugin.
  • Document the cooperative termination concept in the interface's JavaDoc.
  • The interface has one method, isRequested that returns a boolean.
  • Add public static final Termination NEVER = () -> false;.

See also this discussion: !989 (comment 2548515).