public class Tuple9TaskDelegate<T1,T2,T3,T4,T5,T6,T7,T8,T9> extends Object implements Tuple9Task<T1,T2,T3,T4,T5,T6,T7,T8,T9>
_taskDescriptor, LOGGER
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,
TimeUnit unit)
Blocks the current thread for up to the specified amount of time or until
the promise has been resolved.
|
boolean |
cancel(Exception reason)
Attempts to cancel the object with the given reason.
|
void |
contextRun(Context context,
Task<?> parent,
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.
|
Throwable |
getError()
Returns the error in this promise, if there is one.
|
Long |
getId()
Unique identifier of the task.
|
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(Function<Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9>,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, fromCompletionStage, fromCompletionStage, map, map, par, par, par, par, par, par, par, par, par, par, par, par, par, par, par, toTry, toTry, transform, transform, value, value, withDelay, withDelay, withRetryPolicy, withRetryPolicy, withRetryPolicy, withRetryPolicy, withSafeSideEffect, withSafeSideEffect, withSafeSideEffect, withSafeSideEffect, withSideEffect, withSideEffect, withSideEffect, withSideEffect, withTimeout
toCompletionStage
public boolean cancel(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 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 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 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, Collection<Task<?>> predecessors)
public boolean await(long time, TimeUnit unit) throws 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.
public 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.
The instance passed in to PromiseListener.onResolved(Promise)
method does not have to
be the exact same instance the PromiseListener
was registered with.
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 Long getId()
public void setTraceValueSerializer(Function<Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9>,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()
Copyright © 2018. All rights reserved.