Package org.jppf.management.diagnostics
Class AbstractThreadDumpWriter
java.lang.Object
org.jppf.management.diagnostics.AbstractThreadDumpWriter
- All Implemented Interfaces:
Closeable,AutoCloseable,ThreadDumpWriter
- Direct Known Subclasses:
HTMLThreadDumpWriter,TextThreadDumpWriter
Abstract implementation of a
ThreadDumpWriter.- Author:
- Laurent Cohen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringBuilderThe current identation to use before writing each line of the output.protected intThe current identation level of the output.protected final StringThe character sequence used for the indentation, for instance spaces or tabs.protected final PrintWriterThe underlying print writer.protected final StringThe title given to the printed thread dump. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractThreadDumpWriter(Writer writer, String title, String indentString) Intiialize this printer with the specified writer. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidDecrement the current indentation level.protected StringGet the current indentation.protected voidIncrement the current indentation level.voidprintString(String message) Print the stpecified string.voidprintThreadDump(ThreadDump threadDump) Print the specified thread dump.protected StringGet a simple representation for the specified lock.protected StringGet a simple representation fort he specified thread.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jppf.management.diagnostics.ThreadDumpWriter
printDeadlocks, printThread
-
Field Details
-
out
The underlying print writer. -
indentString
The character sequence used for the indentation, for instance spaces or tabs. -
indentLevel
protected int indentLevelThe current identation level of the output. -
indent
The current identation to use before writing each line of the output. -
title
The title given to the printed thread dump.
-
-
Constructor Details
-
AbstractThreadDumpWriter
Intiialize this printer with the specified writer.- Parameters:
writer- the writer to print to.indentString- the string to use as indentation.title- the title given to the printed thread dump.
-
-
Method Details
-
printThreadDump
Description copied from interface:ThreadDumpWriterPrint the specified thread dump.- Specified by:
printThreadDumpin interfaceThreadDumpWriter- Parameters:
threadDump- the thread dump to print.
-
simpleName
Get a simple representation fort he specified thread.- Parameters:
ti- the thread information to use.- Returns:
- a string in format
thread id thread_id "thread_name".
-
simpleName
Get a simple representation for the specified lock.- Parameters:
li- the lock information to use.- Returns:
- a string in format
lock_class_name@lock_hashcode.
-
printString
Print the stpecified string.- Parameters:
message- the string to print.
-
incIndent
protected void incIndent()Increment the current indentation level. -
decIndent
protected void decIndent()Decrement the current indentation level. -
getIndent
Get the current indentation.- Returns:
- the indentation as a string.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-