< prev index next > src/java.base/share/classes/jdk/internal/vm/ThreadSnapshot.java
Print this page
import java.util.stream.Stream;
/**
* Represents a snapshot of information about a Thread.
*/
! class ThreadSnapshot {
private static final StackTraceElement[] EMPTY_STACK = new StackTraceElement[0];
private static final ThreadLock[] EMPTY_LOCKS = new ThreadLock[0];
// filled by VM
private String name;
import java.util.stream.Stream;
/**
* Represents a snapshot of information about a Thread.
*/
! public class ThreadSnapshot {
private static final StackTraceElement[] EMPTY_STACK = new StackTraceElement[0];
private static final ThreadLock[] EMPTY_LOCKS = new ThreadLock[0];
// filled by VM
private String name;
private ThreadSnapshot() {}
/**
* Take a snapshot of a Thread to get all information about the thread.
! * Return null if a ThreadSnapshot is not created, for example if the
- * thread has terminated.
- * @throws UnsupportedOperationException if not supported by VM
*/
! static ThreadSnapshot of(Thread thread) {
ThreadSnapshot snapshot = create(thread);
if (snapshot == null) {
! return null; // thread terminated
}
if (snapshot.stackTrace == null) {
snapshot.stackTrace = EMPTY_STACK;
}
if (snapshot.locks != null) {
private ThreadSnapshot() {}
/**
* Take a snapshot of a Thread to get all information about the thread.
! * Return null if the thread is not alive.
*/
! public static ThreadSnapshot of(Thread thread) {
ThreadSnapshot snapshot = create(thread);
if (snapshot == null) {
! return null; // thread not alive
}
if (snapshot.stackTrace == null) {
snapshot.stackTrace = EMPTY_STACK;
}
if (snapshot.locks != null) {
}
/**
* Returns the thread stack trace.
*/
! StackTraceElement[] stackTrace() {
return stackTrace;
}
/**
* Returns the thread's parkBlocker.
}
/**
* Returns the thread stack trace.
*/
! public StackTraceElement[] stackTrace() {
return stackTrace;
}
/**
* Returns the thread's parkBlocker.
< prev index next >