Add Termination.throwIfRequested method, to simplify handling of cooperative termination
From !1071 (comment 2827474):
We discussed the exception, and opted to put it in
common.java. We can reuse it for termination checking in general, in some later issue. It would prevent having to passnulleverywhere, check fornulleverywhere. We could just check for termination and let that throw the exception. We then handle that exception in the application framework, automatically.
We can thus use the TerminationException that is added in !1071 (merged).