Class AbstractThreadDumpWriter

java.lang.Object
org.jppf.management.diagnostics.AbstractThreadDumpWriter
All Implemented Interfaces:
Closeable, AutoCloseable, ThreadDumpWriter
Direct Known Subclasses:
HTMLThreadDumpWriter, TextThreadDumpWriter

public abstract class AbstractThreadDumpWriter extends Object implements ThreadDumpWriter
Abstract implementation of a ThreadDumpWriter.
Author:
Laurent Cohen
  • Field Details

    • out

      protected final PrintWriter out
      The underlying print writer.
    • indentString

      protected final String indentString
      The character sequence used for the indentation, for instance spaces or tabs.
    • indentLevel

      protected int indentLevel
      The current identation level of the output.
    • indent

      protected StringBuilder indent
      The current identation to use before writing each line of the output.
    • title

      protected final String title
      The title given to the printed thread dump.
  • Constructor Details

    • AbstractThreadDumpWriter

      public AbstractThreadDumpWriter(Writer writer, String title, String indentString)
      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

      public void printThreadDump(ThreadDump threadDump)
      Description copied from interface: ThreadDumpWriter
      Print the specified thread dump.
      Specified by:
      printThreadDump in interface ThreadDumpWriter
      Parameters:
      threadDump - the thread dump to print.
    • simpleName

      protected String simpleName(ThreadInformation ti)
      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

      protected String simpleName(LockInformation li)
      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

      public void printString(String message)
      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

      protected String getIndent()
      Get the current indentation.
      Returns:
      the indentation as a string.
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException