Class ProcessWatcher

  • All Implemented Interfaces:
    Runnable

    public class ProcessWatcher
    extends Thread
    Watcher that can register listeners that will fire when the process has finished.
    • Constructor Detail

      • ProcessWatcher

        public ProcessWatcher​(ProcessBuilder aProcessBuilder)
                       throws IOException
        Creates a watcher for a Process started by the supplied ProcessBuilder.
        Parameters:
        aProcessBuilder - A builder that will spawn the process to watch
        Throws:
        IOException - If there is trouble starting the process
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread
      • addListener

        public ProcessWatcher addListener​(ProcessListener aListener)
        Add a ProcessListener to this watcher.
        Parameters:
        aListener - A process listener to add to this watcher
        Returns:
        The process watcher to which the listener has been attached
      • removeListener

        public ProcessWatcher removeListener​(ProcessListener aListener)
        Remove a ProcessListener to this watcher.
        Parameters:
        aListener - A process listener to remove from this watcher
        Returns:
        The process watcher to which the listener has been attached