io.machinecode.then.api.OnCancel Maven / Gradle / Ivy
package io.machinecode.then.api;
/**
* Listener for a {@link Promise} entering a {@link Deferred#CANCELLED} terminal state.
*
* @see Promise
* @author Brent Douglas
* @since 1.0
*/
public interface OnCancel {
/**
* @param mayInterrupt If a running computation may be interrupted.
* @return {@code true} If the promise was cancelled, {@code false} if it had already reached another terminal state.
* @see java.util.concurrent.Future#cancel(boolean)
*/
boolean cancel(final boolean mayInterrupt);
}