Class: MotherBrain::Gear::JMX::Action Private
- Inherits:
-
Object
- Object
- MotherBrain::Gear::JMX::Action
- Defined in:
- lib/mb/gears/jmx/action.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #block ⇒ Object readonly private
- #object_name ⇒ Object readonly private
- #port ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(port, object_name, &block) ⇒ Action
constructor
private
A new instance of Action.
-
#run(job, environment, nodes) ⇒ Object
private
Run this action on the specified nodes.
Constructor Details
#initialize(port, object_name, &block) ⇒ Action
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Action.
18 19 20 21 22 23 24 25 26 |
# File 'lib/mb/gears/jmx/action.rb', line 18 def initialize(port, object_name, &block) unless block_given? && block.arity == 1 raise ArgumentError, "block with one argument required to run JMX actions" end @port = port @object_name = object_name @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/mb/gears/jmx/action.rb', line 12 def block @block end |
#object_name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/mb/gears/jmx/action.rb', line 11 def object_name @object_name end |
#port ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/mb/gears/jmx/action.rb', line 10 def port @port end |
Instance Method Details
#run(job, environment, nodes) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run this action on the specified nodes.
36 37 38 39 40 41 42 |
# File 'lib/mb/gears/jmx/action.rb', line 36 def run(job, environment, nodes) nodes.each do |node| connection = ::JMX::MBean.connection(host: node.public_hostname, port: port) mbean = ::JMX::MBean.find_by_name(object_name, connection: connection) block.call(mbean) end end |