@@ -0,0 +1,640 @@
+package org.metaborg.util.task;%0A%0Apublic class RateLimitedCancel implements ICancel %7B%0A%0A    private final ICancel cancel;%0A    private final int rate;%0A%0A    private int n = 0;%0A%0A    public RateLimitedCancel(ICancel cancel, int rate) %7B%0A        this.cancel = cancel;%0A        this.rate = rate;%0A    %7D%0A%0A    @Override public boolean cancelled() %7B%0A        return (n++ %25 rate) == 0 ? cancel.cancelled() : false;%0A    %7D%0A%0A    @Override public void throwIfCancelled() throws InterruptedException %7B%0A        if((n++ %25 rate) == 0) %7B%0A            cancel.throwIfCancelled();%0A        %7D%0A    %7D%0A%0A    @Override public void cancel() %7B%0A        cancel.cancel();%0A    %7D%0A%0A%7D%0A

Add cancellation token that checks only once every n invocations.