Class: Leafy::Rack::ThreadDumpWriter
- Inherits:
-
Object
- Object
- Leafy::Rack::ThreadDumpWriter
- Defined in:
- lib/leafy/rack/thread_dump.rb
Instance Method Summary collapse
-
#initialize ⇒ ThreadDumpWriter
constructor
A new instance of ThreadDumpWriter.
- #to_text ⇒ Object
Constructor Details
#initialize ⇒ ThreadDumpWriter
Returns a new instance of ThreadDumpWriter.
9 10 11 12 13 14 15 16 |
# File '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 |
Instance Method Details
#to_text ⇒ Object
18 19 20 21 22 23 24 25 |
# File '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 |