Class Handler
- All Implemented Interfaces:
Serializable
,org.jenkinsci.remoting.SerializableOnlyOverRemoting
VirtualChannel.export(java.lang.Class<T>, T)
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract 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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jenkinsci.remoting.SerializableOnlyOverRemoting
getChannelForSerialization
-
Constructor Details
-
Handler
public Handler()
-
-
Method Details
-
output
Notification that new process output is available.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.- Parameters:
stream
- a way to read process output which has not already been handled- Throws:
Exception
- if anything goes wrong, this watch is deactivated
-
exited
Notification that the process has exited or vanished.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 specializedLauncher
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.- Parameters:
code
- the exit code, if known (0 conventionally represents success); may be negative for anomalous conditions such as a missing processoutput
- standard output captured, ifDurableTask.captureOutput()
was called; else null- Throws:
Exception
-