diff options
author | Paul Duffin <paulduffin@google.com> | 2016-12-14 12:50:47 +0000 |
---|---|---|
committer | Pete Bentley <prb@google.com> | 2021-03-02 23:57:01 +0000 |
commit | adac35f1ea1f9987d9843236991ad4120e704bcb (patch) | |
tree | 461389c0889b90a1161890bf7112b7ee4dcf6fe0 /src/main/java/org/junit/rules/Timeout.java | |
parent | 77cf67c410a013f5e33dc7b333a614f7e1b5ac66 (diff) | |
download | junit-adac35f1ea1f9987d9843236991ad4120e704bcb.tar.gz |
Remove support for stuck threads
The experimental support for stuck threads requires access to
the java.lang.management package which is not supported on
Android.
This change re-lands https://r.android.com/1601635
Bug: 129054170
Test: m checkbuild
Change-Id: I4b37c2d09b5c68afde438c343b41fcdc788c578e
(cherry picked from commit 4156f43b51c6f2d42df6e45535e1967aa46514d3)
Diffstat (limited to 'src/main/java/org/junit/rules/Timeout.java')
-rw-r--r-- | src/main/java/org/junit/rules/Timeout.java | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/main/java/org/junit/rules/Timeout.java b/src/main/java/org/junit/rules/Timeout.java index 334a923..5cf905a 100644 --- a/src/main/java/org/junit/rules/Timeout.java +++ b/src/main/java/org/junit/rules/Timeout.java @@ -40,7 +40,6 @@ import java.util.concurrent.TimeUnit; public class Timeout implements TestRule { private final long timeout; private final TimeUnit timeUnit; - private final boolean lookForStuckThread; /** * Returns a new builder for building an instance. @@ -80,7 +79,6 @@ public class Timeout implements TestRule { public Timeout(long timeout, TimeUnit timeUnit) { this.timeout = timeout; this.timeUnit = timeUnit; - lookForStuckThread = false; } /** @@ -92,7 +90,6 @@ public class Timeout implements TestRule { protected Timeout(Builder builder) { timeout = builder.getTimeout(); timeUnit = builder.getTimeUnit(); - lookForStuckThread = builder.getLookingForStuckThread(); } /** @@ -125,16 +122,6 @@ public class Timeout implements TestRule { } /** - * Gets whether this {@code Timeout} will look for a stuck thread - * when the test times out. - * - * @since 4.12 - */ - protected final boolean getLookingForStuckThread() { - return lookForStuckThread; - } - - /** * Creates a {@link Statement} that will run the given * {@code statement}, and timeout the operation based * on the values configured in this rule. Subclasses @@ -146,7 +133,6 @@ public class Timeout implements TestRule { Statement statement) throws Exception { return FailOnTimeout.builder() .withTimeout(timeout, timeUnit) - .withLookingForStuckThread(lookForStuckThread) .build(statement); } @@ -205,25 +191,6 @@ public class Timeout implements TestRule { } /** - * Specifies whether to look for a stuck thread. If a timeout occurs and this - * feature is enabled, the rule will look for a thread that appears to be stuck - * and dump its backtrace. This feature is experimental. Behavior may change - * after the 4.12 release in response to feedback. - * - * @param enable {@code true} to enable the feature - * @return {@code this} for method chaining. - */ - public Builder withLookingForStuckThread(boolean enable) { - this.lookForStuckThread = enable; - return this; - } - - protected boolean getLookingForStuckThread() { - return lookForStuckThread; - } - - - /** * Builds a {@link Timeout} instance using the values in this builder., */ public Timeout build() { |