Package org.apache.logging.log4j.message
Class ThreadDumpMessage
- java.lang.Object
-
- org.apache.logging.log4j.message.ThreadDumpMessage
-
- All Implemented Interfaces:
java.io.Serializable
,Message
,StringBuilderFormattable
@AsynchronouslyFormattable public class ThreadDumpMessage extends java.lang.Object implements Message, StringBuilderFormattable
Captures information about all running Threads.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ThreadDumpMessage.BasicThreadInfoFactory
Factory to create basic thread information.private static class
ThreadDumpMessage.ThreadDumpMessageProxy
Proxy pattern used to serialize the ThreadDumpMessage.static interface
ThreadDumpMessage.ThreadInfoFactory
Factory to create Thread information.
-
Field Summary
Fields Modifier and Type Field Description private static ThreadDumpMessage.ThreadInfoFactory
FACTORY
private java.lang.String
formattedMessage
private static long
serialVersionUID
private java.util.Map<ThreadInformation,java.lang.StackTraceElement[]>
threads
private java.lang.String
title
-
Constructor Summary
Constructors Modifier Constructor Description ThreadDumpMessage(java.lang.String title)
Generate a ThreadDumpMessage with a title.private
ThreadDumpMessage(java.lang.String formattedMsg, java.lang.String title)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
formatTo(java.lang.StringBuilder sb)
Writes a text representation of this object into the specifiedStringBuilder
, ideally without allocating temporary objects.private static ThreadDumpMessage.ThreadInfoFactory
getFactory()
java.lang.String
getFormat()
Returns the title.java.lang.String
getFormattedMessage()
Returns the ThreadDump in printable format.java.lang.Object[]
getParameters()
Returns an array with a single element, a Map containing the ThreadInformation as the key.java.lang.Throwable
getThrowable()
Always returns null.private static ThreadDumpMessage.ThreadInfoFactory
initFactory(java.lang.ClassLoader classLoader)
private void
readObject(java.io.ObjectInputStream stream)
java.lang.String
toString()
protected java.lang.Object
writeReplace()
Creates a ThreadDumpMessageProxy that can be serialized.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
FACTORY
private static ThreadDumpMessage.ThreadInfoFactory FACTORY
-
threads
private volatile java.util.Map<ThreadInformation,java.lang.StackTraceElement[]> threads
-
title
private final java.lang.String title
-
formattedMessage
private java.lang.String formattedMessage
-
-
Method Detail
-
getFactory
private static ThreadDumpMessage.ThreadInfoFactory getFactory()
-
initFactory
private static ThreadDumpMessage.ThreadInfoFactory initFactory(java.lang.ClassLoader classLoader)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getFormattedMessage
public java.lang.String getFormattedMessage()
Returns the ThreadDump in printable format.- Specified by:
getFormattedMessage
in interfaceMessage
- Returns:
- the ThreadDump suitable for logging.
-
formatTo
public void formatTo(java.lang.StringBuilder sb)
Description copied from interface:StringBuilderFormattable
Writes a text representation of this object into the specifiedStringBuilder
, ideally without allocating temporary objects.- Specified by:
formatTo
in interfaceStringBuilderFormattable
- Parameters:
sb
- the StringBuilder to write into
-
getFormat
public java.lang.String getFormat()
Returns the title.
-
getParameters
public java.lang.Object[] getParameters()
Returns an array with a single element, a Map containing the ThreadInformation as the key. and the StackTraceElement array as the value;- Specified by:
getParameters
in interfaceMessage
- Returns:
- the "parameters" to this Message.
-
writeReplace
protected java.lang.Object writeReplace()
Creates a ThreadDumpMessageProxy that can be serialized.- Returns:
- a ThreadDumpMessageProxy.
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.InvalidObjectException
- Throws:
java.io.InvalidObjectException
-
getThrowable
public java.lang.Throwable getThrowable()
Always returns null.- Specified by:
getThrowable
in interfaceMessage
- Returns:
- null
-
-