intarsys runtime library

de.intarsys.tools.concurrent
Class AbstractFutureTask<R>

java.lang.Object
  extended by de.intarsys.tools.concurrent.AbstractFutureTask<R>
Type Parameters:
R -
All Implemented Interfaces:
Runnable, Future
Direct Known Subclasses:
GenericFutureTask, TaskSequence, TaskStep

public abstract class AbstractFutureTask<R>
extends Object
implements Runnable, Future

This is an alternate implementation for FutureTask, which is in some cases not flexible enough.


Method Summary
 boolean cancel(boolean interrupt)
           
 R get()
           
 R get(long timeout, TimeUnit unit)
          Wait for the result.
 Throwable getException()
           
 ITaskListener getTaskListener()
           
 boolean isActive()
           
 boolean isAsynch()
           
 boolean isCancelled()
           
 boolean isDone()
           
 boolean isFailed()
           
 void reset()
           
 void run()
           
 void runAsync()
           
 void setAsynch(boolean asynch)
           
 void setTaskListener(ITaskListener taskListener)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

cancel

public boolean cancel(boolean interrupt)
Specified by:
cancel in interface Future

get

public R get()
      throws InterruptedException,
             ExecutionException
Specified by:
get in interface Future
Throws:
InterruptedException
ExecutionException

get

public R get(long timeout,
             TimeUnit unit)
      throws InterruptedException,
             ExecutionException,
             TimeoutException
Wait for the result. The "timeout" parameter allows to

Specified by:
get in interface Future
Throws:
InterruptedException
ExecutionException
TimeoutException
See Also:
Future.get(long, java.util.concurrent.TimeUnit)

getException

public Throwable getException()

getTaskListener

public ITaskListener getTaskListener()

isActive

public boolean isActive()

isAsynch

public boolean isAsynch()

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface Future

isDone

public boolean isDone()
Specified by:
isDone in interface Future

isFailed

public boolean isFailed()

reset

public void reset()

run

public final void run()
Specified by:
run in interface Runnable

runAsync

public final void runAsync()

setAsynch

public void setAsynch(boolean asynch)

setTaskListener

public void setTaskListener(ITaskListener taskListener)

toString

public String toString()
Overrides:
toString in class Object

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.