TraceRecord Class — netty Architecture
Architecture documentation for the TraceRecord class in ResourceLeakDetector.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD efd8fd00_279e_1a41_04ab_1ca04d075259["TraceRecord"] d32ce738_76fd_52e1_72e6_97f959369f2a["ResourceLeakDetector.java"] efd8fd00_279e_1a41_04ab_1ca04d075259 -->|defined in| d32ce738_76fd_52e1_72e6_97f959369f2a 04fbb310_2310_c4f9_f7f0_2c4a7cdf67fb["TraceRecord()"] efd8fd00_279e_1a41_04ab_1ca04d075259 -->|method| 04fbb310_2310_c4f9_f7f0_2c4a7cdf67fb d26368ea_2377_6726_9fe5_56eb62b032f5["String()"] efd8fd00_279e_1a41_04ab_1ca04d075259 -->|method| d26368ea_2377_6726_9fe5_56eb62b032f5
Relationship Graph
Source Code
common/src/main/java/io/netty/util/ResourceLeakDetector.java lines 668–738
private static class TraceRecord extends Throwable {
private static final long serialVersionUID = 6065153674892850720L;
public static final int BOTTOM_POS = -1;
public static final int CLOSE_MARK_POS = -2;
private static final TraceRecord BOTTOM = new TraceRecord(false) {
private static final long serialVersionUID = 7396077602074694571L;
// Override fillInStackTrace() so we not populate the backtrace via a native call and so leak the
// Classloader.
// See https://github.com/netty/netty/pull/10691
@Override
public Throwable fillInStackTrace() {
return this;
}
};
private final String hintString;
private final TraceRecord next;
private final int pos;
TraceRecord(TraceRecord next, Object hint) {
// This needs to be generated even if toString() is never called as it may change later on.
hintString = hint instanceof ResourceLeakHint ? ((ResourceLeakHint) hint).toHintString() : hint.toString();
this.next = next;
this.pos = next.pos + 1;
}
TraceRecord(TraceRecord next) {
hintString = null;
this.next = next;
this.pos = next.pos + 1;
}
// Used to terminate the stack
private TraceRecord(boolean closeMarker) {
hintString = null;
next = null;
pos = closeMarker ? CLOSE_MARK_POS : BOTTOM_POS;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(2048);
if (hintString != null) {
buf.append("\tHint: ").append(hintString).append(NEWLINE);
}
// Append the stack trace.
StackTraceElement[] array = getStackTrace();
// Skip the first three elements.
out: for (int i = 3; i < array.length; i++) {
StackTraceElement element = array[i];
// Strip the noisy stack trace elements.
String[] exclusions = excludedMethods.get();
for (int k = 0; k < exclusions.length; k += 2) {
// Suppress a warning about out of bounds access
// since the length of excludedMethods is always even, see addExclusions()
if (exclusions[k].equals(element.getClassName())
&& exclusions[k + 1].equals(element.getMethodName())) {
continue out;
}
}
buf.append('\t');
buf.append(element.toString());
buf.append(NEWLINE);
}
return buf.toString();
}
}
Source
Frequently Asked Questions
What is the TraceRecord class?
TraceRecord is a class in the netty codebase, defined in common/src/main/java/io/netty/util/ResourceLeakDetector.java.
Where is TraceRecord defined?
TraceRecord is defined in common/src/main/java/io/netty/util/ResourceLeakDetector.java at line 668.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free