Brooklyn

brooklyn.util.task.system
[Java] Class ProcessTaskWrapper

java.lang.Object
  brooklyn.util.task.system.ProcessTaskStub
      brooklyn.util.task.system.ProcessTaskWrapper
All Implemented Interfaces:
TaskWrapper

public abstract class ProcessTaskWrapper
extends ProcessTaskStub

Wraps a fully constructed process task, and allows callers to inspect status. Note that methods in here such as getStdout() will return partially completed streams while the task is ongoing (and exit code will be null). You can block() or get() as conveniences on the underlying getTask().


Nested Class Summary
protected class ProcessTaskWrapper.ProcessTaskInternalJob

 
Field Summary
protected java.lang.Integer exitCode

protected java.io.ByteArrayOutputStream stderr

protected java.io.ByteArrayOutputStream stdout

 
Fields inherited from class ProcessTaskStub
commands, completionListeners, config, extraErrorMessage, machine, requireExitCodeZero, returnResultTransformation, returnType, runAsRoot, runAsScript, shellEnvironment, summary
 
Constructor Summary
protected ProcessTaskWrapper(AbstractProcessTaskFactory constructor)

 
Method Summary
Task asTask()

ProcessTaskWrapper block()

blocks until the task completes; does not throw

RET get()

blocks and gets the result, throwing if there was an exception

java.lang.Integer getExitCode()

java.lang.String getStderr()

byte[] getStderrBytes()

java.lang.String getStdout()

byte[] getStdoutBytes()

Task getTask()

boolean isDone()

true iff the process has completed (with or without failure)

protected void run(ConfigBag config)

protected java.lang.String taskTypeShortName()

java.lang.String toString()

 
Methods inherited from class ProcessTaskStub
getCommands, getCompletionListeners, getConfig, getMachine, getShellEnvironment, getSummary, toString
 

Field Detail

exitCode

protected java.lang.Integer exitCode


stderr

protected java.io.ByteArrayOutputStream stderr


stdout

protected java.io.ByteArrayOutputStream stdout


 
Constructor Detail

ProcessTaskWrapper

protected ProcessTaskWrapper(AbstractProcessTaskFactory constructor) {
protected ProcessTaskWrapper(AbstractProcessTaskFactory constructor)


 
Method Detail

asTask

public Task asTask() {
public Task asTask()


block

public ProcessTaskWrapper block()
blocks until the task completes; does not throw


get

public RET get()
blocks and gets the result, throwing if there was an exception


getExitCode

public java.lang.Integer getExitCode()


getStderr

public java.lang.String getStderr()


getStderrBytes

public byte[] getStderrBytes()


getStdout

public java.lang.String getStdout()


getStdoutBytes

public byte[] getStdoutBytes()


getTask

public Task getTask() {
public Task getTask()


isDone

public boolean isDone()
true iff the process has completed (with or without failure)


run

protected void run(ConfigBag config)


taskTypeShortName

protected java.lang.String taskTypeShortName()


toString

}
public java.lang.String toString()


 

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