Top Description Fields Methods
org.junit.jupiter.api.extension

public Interface PreInterruptCallback

extends Extension
Annotations
@API
status:MAINTAINED
since:5.13.3
Static Imports
org.apiguardian.api.API.Status.MAINTAINED

PreInterruptCallback defines the API for Extensions that wish to be called prior to invocations of Thread#interrupt() by the org.junit.jupiter.api.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
org.junit.jupiter.api.Timeout

Field Summary

Modifier and TypeField and Description
public 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.

Method Summary

Modifier and TypeMethod and Description
public void
beforeThreadInterrupt(PreInterruptContext
the context with the target Thread, which will get interrupted.
preInterruptContext
,
ExtensionContext
the extension context for the callback; never null
extensionContext
)

Callback that is invoked before a Thread is interrupted with Thread#interrupt().

Field Detail

THREAD_DUMP_ENABLED_PROPERTY_NAMEback to summary
public 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.

Annotations
@API
status:MAINTAINED
since:5.13.3
Since
5.12

Method Detail

beforeThreadInterruptback to summary
public 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:PreInterruptContext

the context with the target Thread, which will get interrupted.

extensionContext:ExtensionContext

the extension context for the callback; never null

Annotations
@API
status:MAINTAINED
since:5.13.3
Since
5.12
See Also
PreInterruptContext