package org.helioviewer.jhv.threads;

import java.util.concurrent.FutureTask;

public class CancelTask extends FutureTask<Void> {

    public CancelTask(FutureTask<?> abolishTask) {
        super(new Runnable() {
                private FutureTask<?> abolishTask;

                public Runnable init(FutureTask<?> abolishTask) {
                    this.abolishTask = abolishTask;
                    return this;
                }

                @Override
                public void run() {
                    abolishTask.cancel(true);
                }
            }.init(abolishTask), null);
    }

}

package org.helioviewer.jhv.threads;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

public class CancelTask extends FutureTask<Boolean> {

    public CancelTask(FutureTask<?> cancelTask) {
        super(new Callable<Boolean>() {
                private FutureTask<?> _cancelTask;

                public Callable init(FutureTask<?> _cancelTask) {
                    this._cancelTask = _cancelTask;
                    return this;
                }

                @Override
                public Boolean call() {
                    return _cancelTask.cancel(true);
                }
            }.init(cancelTask));
    }

}

Use Callable to be able to retrieve the result of cancel
Use Callable to be able to retrieve the result of cancel 

git-svn-id: 4e353c0944fe8da334633afc35765ef362dec675@5095 b4e469a2-07ce-4b26-9273-4d7d95a670c7
