danny.lesnik
danny.lesnik

Reputation: 18639

How to cancel FutureResult execution

I'm using 3rd Party concurrency library ported to 1.4 which can be downloaded from here http://altair.cs.oswego.edu/pipermail/concurrency-interest/2004-September/001035.html

  Executor executor = new PooledExecutor.....
  FutureResult futureImage = new FutureResult();
   Runnable command = futureImage.setter(new Callable() {
          public Object call() { //doSomething }
       });
       executor.execute(command);

I need to cancel FutureResult or stop execution of current Runnable.

If I were using Future<P> from java 1.5, I would call cancel() method, but how can I do it here?

Upvotes: 1

Views: 147

Answers (1)

Daniel
Daniel

Reputation: 28074

Implement Cancel yourself, for example by providing a cancelled variable which you check during execution of your future.

Upvotes: 1

Related Questions