Full thread stack dump on timeout with custom handler #770
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.
This is an attempt to start addressing: #463 Add ability for timeout to print full thread stack dump
=> Extending the initial rudimentary attempt of #768 to allow "installing" an additional custom timeout handler (that can optionally also add a further exception to the test timeout exception) by a globally set custom timeout handler based on a system property, that is instantiated via reflection.
This custom timeout handler is also desirable to overcome the Java 1.5 compatibility requirement of JUnit, so any default timeout handler bundled with JUnit needs to adhere to this compatibility too: but quite some interesting thread dump information (locks, monitors, synchronizers) can only be retrieved from ThreadMXBean from Java >= 1.6, I think.
(Note one self test still fails in Ant context, but not in Eclipse though -- why is that the case? can it be the parallel usage of a test case timeout via annotation attribute and the global test class timeout via rule kind of interfere? but why is it then working in Eclipse?)
Deadlocked threads of self tests are not surviving anymore (fixed in a subsequent commit; in contrast to some infinite loop running threads from other self tests...
=> In order to fix that and allow full thread stack dump in custom handler, the interrupting of the test thread was moved slightly down.
What do you think of that approach?