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.

        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

        @Asynchronous
        public abstract void exited​(int code,
                                    @Nullable
                                    byte[] output)
                             throws Exception
        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 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.

        Parameters:
        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
        Throws:
        Exception