public boolean cancel() {
        synchronized (taskMutex) {

            if (taskDisposable == null) {
                return false;
            }
            taskDisposable.dispose();
            taskDisposable = null;
            postEvent(new WorkerTaskEvent<>(this, WorkerTaskEventType.CANCELLED, null, null, null, null));

            return true;
        }
    }
Cancels the current task if it is running
main/src/main/java/cgeo/geocaching/utils/workertask/WorkerTask.java