public abstract class Handler extends Object implements Serializable
VirtualChannel.export(java.lang.Class<T>, T).| Constructor and Description |
|---|
Handler() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
exited(int code,
byte[] output)
Notification that the process has exited or vanished.
|
abstract void |
output(InputStream stream)
Notification that new process output is available.
|
public abstract void output(@Nonnull InputStream stream) throws Exception
Should only be called when at least one byte is available. Whatever bytes are actually read will not be offered on the next call, if there is one; there is no need to close the stream.
There is no guarantee that output is offered in the form of complete lines of text, though in the typical case of line-oriented output it is likely that it will end in a newline.
Buffering is the responsibility of the caller, and InputStream.markSupported() may be false.
stream - a way to read process output which has not already been handledException - if anything goes wrong, this watch is deactivatedpublic abstract void exited(int code,
@Nullable
byte[] output)
throws Exception
output(java.io.InputStream) should have been called with any final uncollected output.
Any metadata associated with the process may be deleted after this call completes, rendering subsequent Controller calls unsatisfiable.
Note that unlike Controller.exitStatus(FilePath, Launcher), no specialized Launcher is available on the agent,
so if there are specialized techniques for determining process liveness they will not be considered here;
you still need to occasionally poll for an exit status from the master.
code - the exit code, if known (0 conventionally represents success); may be negative for anomalous conditions such as a missing processoutput - standard output captured, if DurableTask.captureOutput() was called; else nullException - if anything goes wrong, this watch is deactivatedCopyright © 2016–2019. All rights reserved.