Brooklyn

brooklyn.util.task
[Java] Class Tasks

java.lang.Object
  brooklyn.util.task.Tasks

public class Tasks

Method Summary
static Task current()

the Task where the current thread is executing, if executing in a Task, otherwise null

static java.lang.Object resolveValue(java.lang.Object v, java.lang.Class type, ExecutionContext exec)

@see #resolveValue(Object, Class, ExecutionContext, String)

static java.lang.Object resolveValue(java.lang.Object v, java.lang.Class type, ExecutionContext exec, java.lang.String contextMessage)

attempt to resolve the given value as the given type, waiting on futures, submitting if necessary, and coercing as allowed by TypeCoercions; contextMessage (optional) will be displayed in status reports while it waits (e.g. the name of the config key being looked up)

static void setBlockingDetails(java.lang.String description)

convenience for setting "blocking details" on any task where the current thread is running; typically invoked prior to a wait, for transparency to a user; then invoked with 'null' just after the wait

static void setExtraStatusDetails(java.lang.String notes)

sets extra status details on the current task, if possible (otherwise does nothing).

static java.lang.Object withBlockingDetails(java.lang.String description, java.util.concurrent.Callable code)

convenience for setting "blocking details" on any task where the current thread is running, while the passed code is executed; often used from groovy as withBlockingDetails("sleeping 5s") { Thread.sleep(5000); } .

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Method Detail

current

@SuppressWarnings("rawtypes")
public static Task current()
the Task where the current thread is executing, if executing in a Task, otherwise null


resolveValue

public static java.lang.Object resolveValue(java.lang.Object v, java.lang.Class type, ExecutionContext exec)
See Also:
resolveValue(Object, Class, ExecutionContext, String)


resolveValue

@SuppressWarnings({ "unchecked", "rawtypes" })
public static java.lang.Object resolveValue(java.lang.Object v, java.lang.Class type, ExecutionContext exec, java.lang.String contextMessage)
attempt to resolve the given value as the given type, waiting on futures, submitting if necessary, and coercing as allowed by TypeCoercions; contextMessage (optional) will be displayed in status reports while it waits (e.g. the name of the config key being looked up)


setBlockingDetails

public static void setBlockingDetails(java.lang.String description)
convenience for setting "blocking details" on any task where the current thread is running; typically invoked prior to a wait, for transparency to a user; then invoked with 'null' just after the wait


setExtraStatusDetails

public static void setExtraStatusDetails(java.lang.String notes)
sets extra status details on the current task, if possible (otherwise does nothing). the extra status is presented in Task.getStatusDetails(true)


withBlockingDetails

@SuppressWarnings("rawtypes")
public static java.lang.Object withBlockingDetails(java.lang.String description, java.util.concurrent.Callable code)
convenience for setting "blocking details" on any task where the current thread is running, while the passed code is executed; often used from groovy as withBlockingDetails("sleeping 5s") { Thread.sleep(5000); } . if code block is null, the description is set until further notice (not cleareed).


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.