Class Executor

java.lang.Object
com.github.kokorin.jaffree.process.Executor

public class Executor extends Object
Executor starts threads with provided Runnables and controls all threads it has started.

If exception appears in any of the threads the starter thread is interrupted.

  • Constructor Details

    • Executor

      public Executor(String contextName)
      Creates Executor.
      Parameters:
      contextName - context name for logging
  • Method Details

    • execute

      public void execute(String name, Runnable runnable)
      Executes provided Runnable.

      Note: interrupts invoking thread if exception appears

      Parameters:
      name - thread name suffix
      runnable - runnable to execute
    • getExceptions

      public List<Throwable> getExceptions()
      Returns exceptions (if any) caught during execution.
      Returns:
      exceptions
    • stop

      public void stop()
      Stop execution of all threads started so far (by interruption) threads that are still alive and haven't been interrupted.
    • isRunning

      public boolean isRunning()
      Returns:
      true if at least one of threads is still running.
    • getRunningThreadNames

      public List<String> getRunningThreadNames()
      Returns names of all threads that are still running.
      Returns:
      threads' names