Class Handler

    • Constructor Detail

      • Handler

        public Handler()
    • Method Detail

      • output

        public abstract void output​(@NonNull
                                    InputStream stream)
                             throws Exception
        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.

        stream - a way to read process output which has not already been handled
        Exception - if anything goes wrong, this watch is deactivated
      • exited

        public abstract void exited​(int code,
                                    byte[] output)
                             throws Exception
        Notification that the process has exited or vanished. output( 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 process
        output - standard output captured, if DurableTask.captureOutput() was called; else null