src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/TTY.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
hotspot Cdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/TTY.java
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/TTY.java
Print this page
*** 40,50 ****
public class TTY {
/**
* Support for thread-local suppression of {@link TTY}.
*/
! public static class Filter {
private LogStream previous;
private final Thread thread = Thread.currentThread();
/**
--- 40,50 ----
public class TTY {
/**
* Support for thread-local suppression of {@link TTY}.
*/
! public static class Filter implements AutoCloseable {
private LogStream previous;
private final Thread thread = Thread.currentThread();
/**
*** 86,104 ****
--- 86,119 ----
previous = out();
log.set(LogStream.SINK);
}
/**
+ * Creates an object that will overwrite {@link TTY} for the current thread with a custom
+ * log stream. To revert the overwritten state to how it was before this call, the
+ * {@link #remove()} method must be called on this filter object.
+ */
+ public Filter(LogStream newStream) {
+ previous = out();
+ log.set(newStream);
+ }
+
+ /**
* Reverts the suppression state of {@link TTY} to how it was before this object was
* constructed.
*/
public void remove() {
assert thread == Thread.currentThread();
if (previous != null) {
log.set(previous);
}
}
+
+ @Override
+ public void close() {
+ remove();
+ }
}
/**
* The {@link PrintStream} to which all non-suppressed output from {@link TTY} is written.
*/
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/TTY.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File