Package org.jdeferred2
Class DeferredCallable<D,P>
- java.lang.Object
-
- org.jdeferred2.DeferredCallable<D,P>
-
- Type Parameters:
D
- Type used as return type ofCallable.call()
, andDeferred.resolve(Object)
P
- Type used forDeferred.notify(Object)
- All Implemented Interfaces:
java.util.concurrent.Callable<D>
public abstract class DeferredCallable<D,P> extends java.lang.Object implements java.util.concurrent.Callable<D>
Use this as superclass in case you need to be able to return a result and notify progress. If you don't need to notify progress, you can simply useCallable
- See Also:
notify(Object)
-
-
Field Summary
Fields Modifier and Type Field Description private Deferred<D,java.lang.Throwable,P>
deferred
private DeferredManager.StartPolicy
startPolicy
-
Constructor Summary
Constructors Constructor Description DeferredCallable()
Creates a newDeferredCallable
with DEFAULTstartPolicy
.DeferredCallable(DeferredManager.StartPolicy startPolicy)
Creates a newDeferredCallable
with the givenstartPolicy
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Deferred<D,java.lang.Throwable,P>
getDeferred()
DeferredManager.StartPolicy
getStartPolicy()
protected void
notify(P progress)
Trigger notification of an intermediate result.
-
-
-
Field Detail
-
startPolicy
private final DeferredManager.StartPolicy startPolicy
-
-
Constructor Detail
-
DeferredCallable
public DeferredCallable()
Creates a newDeferredCallable
with DEFAULTstartPolicy
.
-
DeferredCallable
public DeferredCallable(DeferredManager.StartPolicy startPolicy)
Creates a newDeferredCallable
with the givenstartPolicy
.- Parameters:
startPolicy
- the startPolicy to use. will be set to DEFAULT ifnull
.
-
-
Method Detail
-
notify
protected void notify(P progress)
Trigger notification of an intermediate result.- Parameters:
progress
- the value to be sent as a notification- See Also:
Deferred.notify(Object)
-
getStartPolicy
public DeferredManager.StartPolicy getStartPolicy()
-
-