Interface PreInterruptCallback

All Superinterfaces:
Extension

@API(status=EXPERIMENTAL, since="5.12") public interface PreInterruptCallback extends Extension
PreInterruptCallback defines the API for Extensions that wish to be called prior to invocations of Thread.interrupt() by the Timeout extension.

JUnit registers a default implementation that dumps the stacks of all threads to System.out if the "junit.jupiter.execution.timeout.threaddump.enabled" configuration parameter is set to true.

Since:
5.12
See Also:
  • Field Details

    • THREAD_DUMP_ENABLED_PROPERTY_NAME

      @API(status=EXPERIMENTAL, since="5.12") static final String THREAD_DUMP_ENABLED_PROPERTY_NAME
      Property name used to enable dumping the stack of all threads to System.out when a timeout has occurred.

      This behavior is disabled by default.

      Since:
      5.12
      See Also:
  • Method Details

    • beforeThreadInterrupt

      @API(status=EXPERIMENTAL, since="5.12") void beforeThreadInterrupt(PreInterruptContext preInterruptContext, ExtensionContext extensionContext) throws Exception
      Callback that is invoked before a Thread is interrupted with Thread.interrupt().

      Note: There is no guarantee on which Thread this callback will be executed.

      Parameters:
      preInterruptContext - the context with the target Thread, which will get interrupted.
      extensionContext - the extension context for the callback; never null
      Throws:
      Exception
      Since:
      5.12
      See Also: