class Leafy::Rack::ThreadDumpWriter

Public Class Methods

new() click to toggle source
# File leafy-rack/lib/leafy/rack/thread_dump.rb, line 9
def initialize
  begin
    # Some PaaS like Google App Engine blacklist java.lang.managament
    @threads = com.codahale.metrics.jvm.ThreadDump.new(ManagementFactory.getThreadMXBean());
  rescue LoadError
    # we won't be able to provide thread dump
  end
end

Public Instance Methods

to_text() click to toggle source
# File leafy-rack/lib/leafy/rack/thread_dump.rb, line 18
def to_text
  if @threads
    # TODO make this stream
    output = java.io.ByteArrayOutputStream.new
    @threads.dump(output)
    output.to_s
  end
end