Interface ThrowingRunnable<T extends Exception>

Type Parameters:
T - the type of exception that may be thrown

public interface ThrowingRunnable<T extends Exception>
A Runnable that can throw exceptions/errors. Internal use only.
Since:
1.24
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run()
    Run any code provided by an implementation, including code that may throw an exception.
    static <T extends Exception, E extends Exception>
    void
    run(ThrowingRunnable<T> task, Function<T,E> exceptionWrapper)
    Execute the provided task and apply the given exceptionWrapper function on any exception thrown by it.
  • Method Details

    • run

      void run() throws T
      Run any code provided by an implementation, including code that may throw an exception.
      Throws:
      T - any exception thrown by the implementation of this method
    • run

      static <T extends Exception, E extends Exception> void run(ThrowingRunnable<T> task, Function<T,E> exceptionWrapper) throws E
      Execute the provided task and apply the given exceptionWrapper function on any exception thrown by it.
      Type Parameters:
      T - the type of exception that may be thrown
      E - the type of exception that this method may throw, wrapping any thrown by task
      Parameters:
      task - runnable to execute that may thrown an exception T
      exceptionWrapper - wrapper function to wrap/convert an exception T to an exception E
      Throws:
      E - exception thrown when task throws an exception T