Class DefaultFuture<T extends DefaultFuture<?>>
- java.lang.Object
-
- org.apache.karaf.features.internal.download.impl.DefaultFuture<T>
-
- Direct Known Subclasses:
AbstractDownloadTask
public class DefaultFuture<T extends DefaultFuture<?>> extends Object
A simple future
-
-
Constructor Summary
Constructors Constructor Description DefaultFuture()
DefaultFuture(Object lock)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
addListener(FutureListener<T> listener)
T
await()
boolean
await(long timeoutMillis)
boolean
await(long timeout, TimeUnit unit)
T
awaitUninterruptibly()
boolean
awaitUninterruptibly(long timeoutMillis)
boolean
awaitUninterruptibly(long timeout, TimeUnit unit)
void
cancel()
protected Object
getValue()
Return the result of the asynchronous operation.boolean
isCanceled()
boolean
isDone()
T
removeListener(FutureListener<T> listener)
void
setValue(Object newValue)
Set the result of the asynchronous operation, and mark it as finished.
-
-
-
Constructor Detail
-
DefaultFuture
public DefaultFuture()
-
DefaultFuture
public DefaultFuture(Object lock)
Creates a new instance.- Parameters:
lock
- the future lock.
-
-
Method Detail
-
await
public T await() throws InterruptedException
- Throws:
InterruptedException
-
await
public boolean await(long timeout, TimeUnit unit) throws InterruptedException
- Throws:
InterruptedException
-
await
public boolean await(long timeoutMillis) throws InterruptedException
- Throws:
InterruptedException
-
awaitUninterruptibly
public T awaitUninterruptibly()
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeout, TimeUnit unit)
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis)
-
isDone
public boolean isDone()
-
setValue
public void setValue(Object newValue)
Set the result of the asynchronous operation, and mark it as finished.- Parameters:
newValue
- the result of the asynchronous operation.
-
getValue
protected Object getValue()
Return the result of the asynchronous operation.- Returns:
- the result of the asynchronous operation.
-
addListener
public T addListener(FutureListener<T> listener)
-
removeListener
public T removeListener(FutureListener<T> listener)
-
isCanceled
public boolean isCanceled()
-
cancel
public void cancel()
-
-