GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Introduce PreInterruptCallback extension point by AndreasTu · Pull Request #3431 · junit-team/junit-framework

Conversation

@AndreasTu

@AndreasTu AndreasTu commented Aug 19, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Overview

Added PreInterruptCallback extension to allow to hook into the @Timeout extension before the executing Thread is interrupted.

The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.out.
It is disabled by default and must be enabled with: junit.jupiter.execution.timeout.threaddump.enabled = true

Issue: #2938


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

  • There are no TODOs left in the code
  • Method preconditions are checked and documented in the method's Javadoc
  • Coding conventions (e.g. for logging) have been followed
  • Change is covered by automated tests including corner cases, errors, and exception handling
  • Public API has Javadoc and @API annotations
  • Change is documented in the User Guide and Release Notes

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AndreasTu

AndreasTu commented Aug 19, 2023

Copy link
Copy Markdown
Contributor Author

I am currently not happy with the change in MutableExtensionRegistry. Is there another way to get the current active ExtensionRegistry from a current ExtensionContext?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AndreasTu AndreasTu mentioned this pull request Aug 19, 2023
Hook before timeout exception is started by calling interrupt() #2938
Closed
@AndreasTu
AndreasTu force-pushed the fix_2938 branch 2 times, most recently from da26892 to 0c2a0ed Compare August 19, 2023 16:39
@marcphilipp marcphilipp linked an issue Jun 21, 2024 that may be closed by this pull request
Hook before timeout exception is started by calling interrupt() #2938
Closed
marcphilipp
marcphilipp requested changes Oct 15, 2024
View reviewed changes

@marcphilipp marcphilipp left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am currently not happy with the change in MutableExtensionRegistry. Is there another way to get the current active ExtensionRegistry from a current ExtensionContext?

I think we should consider adding a <E extends Extension> List<E> getExtensions(Class<E> extensionType) method to ExtensionContext and storing an ExtensionRegistry as an instance field in the implementations of ExtensionContext. Could you please give that a try?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread documentation/src/docs/asciidoc/user-guide/extensions.adoc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...ter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultPreInterruptCallback.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AndreasTu
AndreasTu force-pushed the fix_2938 branch from 0c2a0ed to bcc6fa4 Compare October 15, 2024 19:09
@AndreasTu

AndreasTu commented Oct 15, 2024

Copy link
Copy Markdown
Contributor Author

@marcphilipp Thanks for the review. And your proposal regarding the ExtensionContext works, but I had to touch more files for that.

marcphilipp reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AndreasTu
AndreasTu requested a review from marcphilipp October 15, 2024 19:12
@AndreasTu
AndreasTu force-pushed the fix_2938 branch from bcc6fa4 to 97a56ea Compare October 15, 2024 19:23
marcphilipp
marcphilipp requested changes Oct 16, 2024
View reviewed changes
Comment thread junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...piter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...ter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...piter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...upiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineDescriptor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...piter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...piter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AndreasTu
AndreasTu force-pushed the fix_2938 branch from a44a82d to 6d2b949 Compare October 17, 2024 05:01
@AndreasTu
AndreasTu requested a review from marcphilipp October 17, 2024 05:02
marcphilipp
marcphilipp requested changes Oct 17, 2024
View reviewed changes
Comment thread documentation/src/docs/asciidoc/user-guide/extensions.adoc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread documentation/src/docs/asciidoc/user-guide/writing-tests.adoc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread documentation/src/docs/asciidoc/user-guide/writing-tests.adoc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread documentation/src/docs/asciidoc/user-guide/extensions.adoc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread documentation/src/docs/asciidoc/user-guide/writing-tests.adoc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...upiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...upiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactory.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AndreasTu
AndreasTu force-pushed the fix_2938 branch from 6d2b949 to 8e5b738 Compare October 17, 2024 15:38
@AndreasTu
AndreasTu requested a review from marcphilipp October 17, 2024 15:38
marcphilipp
marcphilipp requested changes Oct 21, 2024
View reviewed changes
Comment thread ...upiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactory.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AndreasTu
AndreasTu force-pushed the fix_2938 branch from 8e5b738 to 226058c Compare October 21, 2024 17:36
@AndreasTu
AndreasTu requested a review from marcphilipp October 21, 2024 17:36
@AndreasTu
AndreasTu force-pushed the fix_2938 branch from 226058c to c9ee729 Compare October 21, 2024 17:55
marcphilipp
marcphilipp requested changes Oct 23, 2024
View reviewed changes

@marcphilipp marcphilipp left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the requested changes! I've requested one additional change and I'd like to discuss the introduction of ExtensionContext.getExtensions (that I suggested) with the team before we merge this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptContext.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

marcphilipp
marcphilipp requested changes Oct 25, 2024
View reviewed changes

@marcphilipp marcphilipp left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing came out of our team discussion.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AndreasTu @marcphilipp
PreInterruptCallback extension
fddd6b9
Added PreInterruptCallback extension to allow to hook into the
@timeout extension before the executing Thread is interrupted.

The default implementation of PreInterruptCallback will simply print
the stacks of all Thread to System.out.
It is disabled by default and must be enabled with:
junit.jupiter.execution.timeout.threaddump.enabled = true

Issue: junit-team#2938

Co-authored-by: Marc Philipp <[email protected]>
@AndreasTu
AndreasTu force-pushed the fix_2938 branch from c9ee729 to fddd6b9 Compare October 25, 2024 18:30
@AndreasTu
Fixup wrong documentation link.
e12e65c
@AndreasTu
AndreasTu requested a review from marcphilipp October 25, 2024 19:03
marcphilipp
marcphilipp approved these changes Oct 29, 2024
View reviewed changes
Comment thread ...upiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionContextInternal.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@marcphilipp
Remove redundant info
04a45b2
@marcphilipp marcphilipp changed the title PreInterruptCallback extension Introduce PreInterruptCallback extension point Oct 29, 2024
@marcphilipp
marcphilipp merged commit f32aa0a into junit-team:main Oct 29, 2024
@marcphilipp

marcphilipp commented Oct 29, 2024

Copy link
Copy Markdown
Member

@AndreasTu Thank you for your contribution! 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AndreasTu
AndreasTu deleted the fix_2938 branch October 29, 2024 11:29
This was referenced Feb 24, 2025
Bump junit from 5.11.4 to 5.12.0 kousen/java_8_recipes#125
Closed
Bump junit from 5.11.4 to 5.12.0 kousen/IntroGroovy#128
Closed
Bump junit from 5.11.4 to 5.12.0 kousen/junit5_workshop#251
Closed
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.0 kousen/http-client-demo#43
Merged
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.0 kousen/functional_modern_java#31
Closed
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.0 kousen/java_upgrade#44
Merged
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.0 kousen/java_9_recipes#45
Closed
Bump junit from 5.11.4 to 5.12.0 kousen/java_groovy_kotlin#194
Merged
This was referenced Mar 17, 2025
Bump junit from 5.11.4 to 5.12.1 kousen/java_8_recipes#127
Closed
Bump junit from 5.11.4 to 5.12.1 kousen/IntroGroovy#130
Closed
Bump junit from 5.11.4 to 5.12.1 kousen/junit5_workshop#254
Merged
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.1 kousen/java_9_recipes#46
Closed
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.1 kousen/functional_modern_java#32
Closed
This was referenced Apr 14, 2025
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.2 kousen/java_9_recipes#47
Closed
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.2 kousen/functional_modern_java#33
Closed
Bump junit from 5.11.4 to 5.12.2 kousen/java_8_recipes#131
Closed
Bump junit from 5.11.4 to 5.12.2 kousen/IntroGroovy#132
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@marcphilipp marcphilipp marcphilipp approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Hook before timeout exception is started by calling interrupt()

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@AndreasTu @marcphilipp
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.