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 classThreadDumpMessage.BasicThreadInfoFactoryFactory to create basic thread information.private static classThreadDumpMessage.ThreadDumpMessageProxyProxy pattern used to serialize the ThreadDumpMessage.static interfaceThreadDumpMessage.ThreadInfoFactoryFactory to create Thread information.
-
Field Summary
Fields Modifier and Type Field Description private static ThreadDumpMessage.ThreadInfoFactoryFACTORYprivate java.lang.StringformattedMessageprivate static longserialVersionUIDprivate java.util.Map<ThreadInformation,java.lang.StackTraceElement[]>threadsprivate java.lang.Stringtitle
-
Constructor Summary
Constructors Modifier Constructor Description ThreadDumpMessage(java.lang.String title)Generate a ThreadDumpMessage with a title.privateThreadDumpMessage(java.lang.String formattedMsg, java.lang.String title)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidformatTo(java.lang.StringBuilder sb)Writes a text representation of this object into the specifiedStringBuilder, ideally without allocating temporary objects.private static ThreadDumpMessage.ThreadInfoFactorygetFactory()java.lang.StringgetFormat()Returns the title.java.lang.StringgetFormattedMessage()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.ThrowablegetThrowable()Always returns null.private static ThreadDumpMessage.ThreadInfoFactoryinitFactory()private voidreadObject(java.io.ObjectInputStream stream)java.lang.StringtoString()protected java.lang.ObjectwriteReplace()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()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getFormattedMessage
public java.lang.String getFormattedMessage()
Returns the ThreadDump in printable format.- Specified by:
getFormattedMessagein interfaceMessage- Returns:
- the ThreadDump suitable for logging.
-
formatTo
public void formatTo(java.lang.StringBuilder sb)
Description copied from interface:StringBuilderFormattableWrites a text representation of this object into the specifiedStringBuilder, ideally without allocating temporary objects.- Specified by:
formatToin 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:
getParametersin 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:
getThrowablein interfaceMessage- Returns:
- null
-
-