Brooklyn

brooklyn.util.task
[Java] Class DynamicSequentialTask

java.lang.Object
  brooklyn.util.task.BasicTask
      brooklyn.util.task.DynamicSequentialTask
All Implemented Interfaces:
HasTaskChildren, TaskQueueingContext

public class DynamicSequentialTask
extends BasicTask

Represents a task whose run() method can create other tasks which are run sequentially, but that sequence runs in parallel to this task


Nested Class Summary
protected class DynamicSequentialTask.DstJob

 
Field Summary
protected java.lang.Object jobTransitionLock

protected boolean primaryFinished

protected boolean primaryStarted

protected java.lang.Thread primaryThread

protected java.util.Queue secondaryJobsAll

protected java.util.Queue secondaryJobsRemaining

 
Fields inherited from class BasicTask
NO_OP, WARN_IF_NOT_RUN, blockingDetails, blockingTask, description, displayName, em, endTimeUtc, job, listeners, queuedTimeUtc, result, startTimeUtc, submitTimeUtc, submittedByTask, tags, thread
 
Constructor Summary
DynamicSequentialTask()

Constructs a new compound task containing the specified units of work.

DynamicSequentialTask(java.util.concurrent.Callable mainJob)

DynamicSequentialTask(java.util.Map flags, java.util.concurrent.Callable mainJob)

 
Method Summary
boolean cancel(boolean mayInterruptIfRunning)

java.lang.Iterable getChildren()

java.util.List getQueue()

void handleException(java.lang.Throwable throwable)

Task last()

void queue(Task t)

protected void submitBackgroundInheritingContext(Task task)

submits the indicated task for execution in the current execution context, and returns immediately

 
Methods inherited from class BasicTask
addListener, applyTagModifier, asTask, blockUntilEnded, blockUntilEnded, blockUntilStarted, blockUntilStarted, cancel, cancel, equals, finalize, get, get, get, getActiveTaskStatusString, getBlockingDetails, getBlockingTask, getDescription, getDisplayName, getEndTimeUtc, getExecutionManager, getExtraStatusText, getId, getJob, getListeners, getMutableTags, getQueuedTimeUtc, getResult, getStartTimeUtc, getStatusDetail, getStatusString, getStatusSummary, getSubmitTimeUtc, getSubmittedByTask, getTags, getThread, getUnchecked, getUnchecked, hashCode, ignoreIfNotRun, initExecutionManager, initResult, isBegun, isCancelled, isDone, isError, isQueuedAndNotSubmitted, isQueuedOrSubmitted, isSubmitted, lookup, markQueued, resetBlockingDetails, resetBlockingTask, runListeners, setBlockingDetails, setBlockingTask, setEndTimeUtc, setExtraStatusText, setFinalizer, setJob, setStartTimeUtc, setSubmitTimeUtc, setSubmittedByTask, setThread, toString
 

Field Detail

jobTransitionLock

protected final java.lang.Object jobTransitionLock


primaryFinished

protected boolean primaryFinished


primaryStarted

protected boolean primaryStarted


primaryThread

protected java.lang.Thread primaryThread


secondaryJobsAll

protected final java.util.Queue secondaryJobsAll


secondaryJobsRemaining

protected final java.util.Queue secondaryJobsRemaining


 
Constructor Detail

DynamicSequentialTask

public DynamicSequentialTask()
Constructs a new compound task containing the specified units of work.
throws:
IllegalArgumentException if any of the passed child jobs is not one of the above types
Parameters:
jobs - A potentially heterogeneous mixture of java.lang.Runnable, java.util.concurrent.Callable, groovy.lang.Closure and Task can be provided.


DynamicSequentialTask

public DynamicSequentialTask(java.util.concurrent.Callable mainJob)


DynamicSequentialTask

public DynamicSequentialTask(java.util.Map flags, java.util.concurrent.Callable mainJob)


 
Method Detail

cancel

@Override
public boolean cancel(boolean mayInterruptIfRunning)


getChildren

@Override
public java.lang.Iterable getChildren()


getQueue

// allow checked exceptions to be passed through
public java.util.List getQueue()


handleException

public void handleException(java.lang.Throwable throwable)


last

}
public Task last()


queue

@Override
public void queue(Task t)


submitBackgroundInheritingContext

protected void submitBackgroundInheritingContext(Task task)
submits the indicated task for execution in the current execution context, and returns immediately


 

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