Class: Trinidad::Extensions::JmxRemoteServerExtension

Inherits:
ServerExtension
  • Object
show all
Defined in:
lib/trinidad_jmx_remote_extension.rb

Instance Method Summary collapse

Instance Method Details

#configure(tomcat) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/trinidad_jmx_remote_extension.rb', line 13

def configure(tomcat)
  load JmxRemote::JAR_PATH
  listener = Java::OrgApacheCatalinaMbeans::JmxRemoteLifecycleListener.new
  options.each do |key, value| # e.g. useLocalPorts: true
    if listener.respond_to? method = "set#{key.to_s.upcase}"
      listener.send(method, value)
    elsif listener.respond_to? method = "#{key}="
      listener.send(method, value)
    end
  end
  tomcat.server.add_lifecycle_listener listener
end