public class Tuple9TaskDelegate<T1,T2,T3,T4,T5,T6,T7,T8,T9> extends java.lang.Object implements Tuple9Task<T1,T2,T3,T4,T5,T6,T7,T8,T9>
Constructor and Description |
---|
Tuple9TaskDelegate(Task<Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9>> task) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(PromiseListener<Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9>> listener)
Adds a listener to this promise that will be notified when the promise is
resolved.
|
void |
await()
Blocks the current thread for an unbounded amount of time until the promise
has be resolved.
|
boolean |
await(long time,
java.util.concurrent.TimeUnit unit)
Blocks the current thread for up to the specified amount of time or until
the promise has been resolved.
|
boolean |
cancel(java.lang.Exception reason)
Attempts to cancel the object with the given reason.
|
void |
contextRun(Context context,
Task<?> parent,
java.util.Collection<Task<?>> predecessors)
Attempts to run the task with the given context.
|
Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9> |
get()
If the promise's value is set, then this method returns the value.
|
java.lang.Throwable |
getError()
Returns the error in this promise, if there is one.
|
java.lang.Long |
getId()
Unique identifier of the task.
|
java.lang.String |
getName()
Returns the name of this task.
|
Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9> |
getOrDefault(Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9> defaultValue)
Gets the value in this promise or, if the promise contains an error,
returns the given default value.
|
int |
getPriority()
Returns the priority for this task.
|
ShallowTrace |
getShallowTrace()
Returns the ShallowTrace for this task.
|
ShallowTraceBuilder |
getShallowTraceBuilder() |
Trace |
getTrace()
Returns the Trace for this task.
|
TraceBuilder |
getTraceBuilder() |
boolean |
isDone()
Returns
true if this promise is resolved. |
boolean |
isFailed()
Returns
true if the promise has an error. |
boolean |
setPriority(int priority)
Overrides the priority for this task.
|
void |
setTraceValueSerializer(java.util.function.Function<Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9>,java.lang.String> serializer)
Allows adding
String representation of value computed by this task to trace. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
andThen, andThen, cast, flatMap, flatMap, map, map, onFailure, onFailure, recover, recover, recoverWith, recoverWith, shareable, withSideEffect, withSideEffect, withTimeout
action, action, andThen, andThen, andThen, andThen, apply, async, async, async, async, blocking, blocking, callable, callable, failure, failure, flatMap, flatMap, flatten, flatten, map, map, par, par, par, par, par, par, par, par, toTry, toTry, transform, transform, value, value, withSideEffect, withSideEffect
public boolean cancel(java.lang.Exception reason)
false
.cancel
in interface Cancellable
reason
- an Exception indicating why this object was cancelledtrue
iff the object was successfully cancelled as a result
of this invocation.public Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9> get() throws PromiseException
PromiseException
. If the promise has not yet been resolved (i.e.
it has no value and no error) then this method raises a
PromiseUnresolvedException
.public java.lang.Throwable getError() throws PromiseUnresolvedException
null
. If this
promise has no value and no error (i.e. it is unresolved) then a
PromiseUnresolvedException
is thrown.public Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9> getOrDefault(Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9> defaultValue) throws PromiseUnresolvedException
If the promise has not been resolved then this method will throw
PromiseUnresolvedException
.
getOrDefault
in interface Promise<Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9>>
defaultValue
- the default value to return if this promise contains an
error.PromiseUnresolvedException
- if the promise has not yet been resolvedpublic java.lang.String getName()
public int getPriority()
public boolean setPriority(int priority)
The default priority is 0. Use priority < 0
to make a task
lower priority and priority > 0
to make a task higher
priority.
If the task has already started execution the priority cannot be changed.
public void await() throws java.lang.InterruptedException
For asynchronous workflows, use Promise.addListener(PromiseListener)
,
which will notify the user when the promise is resolved instead of blocking
the current thread.
public void contextRun(Context context, Task<?> parent, java.util.Collection<Task<?>> predecessors)
public boolean await(long time, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
true
.
For asynchronous workflows, use Promise.addListener(PromiseListener)
,
which will notify the user when the promise is resolved instead of blocking
the current thread.
await
in interface Promise<Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9>>
time
- the amount of time to waitunit
- the units for the wait timetrue
if the promise is resolved within the specified timejava.lang.InterruptedException
- if the current thread is interruptedpublic ShallowTrace getShallowTrace()
public void addListener(PromiseListener<Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9>> listener)
Listener will be called on a thread that completed this promise.
public Trace getTrace()
public boolean isDone()
true
if this promise is resolved. A promise is resolved
when it has a value or an error.public boolean isFailed()
true
if the promise has an error. Errors can retrieved
using Promise.getError()
.public java.lang.Long getId()
public void setTraceValueSerializer(java.util.function.Function<Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9>,java.lang.String> serializer)
Task
String
representation of value computed by this task to trace.
When this task is finished successfully, value will be converted to String using given
serializer and it will be included in this task's trace.
Failures are automatically included in a trace.
public ShallowTraceBuilder getShallowTraceBuilder()