Class: Backstage::Group

Inherits:
Object show all
Includes:
HasMBean, Resource
Defined in:
lib/groups/models/group.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resource

#association_chain, #available_actions, included, #resource, #to_hash

Methods included from HasMBean

#<=>, #full_name, included, #initialize, #mbean_info, #method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Backstage::HasMBean

Class Method Details

.filterObject



22
23
24
# File 'lib/groups/models/group.rb', line 22

def self.filter
  "jgroups:cluster=*,type=channel"
end

.to_hash_attributesObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/groups/models/group.rb', line 26

def self.to_hash_attributes
  super + [:address,
           :cluster_name,
           :connected,
           :name,
           :number_of_tasks_in_timer,
           :open,
           :received_bytes,
           :received_messages,
           :sent_bytes,
           :sent_messages,
           :stats,
           :timer_threads,
           :version,
           :view]
end

Instance Method Details

#openObject

this shadows Object#open



44
45
46
# File 'lib/groups/models/group.rb', line 44

def open
  mbean["Open"]
end

#protocolsObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/groups/models/group.rb', line 48

def protocols
  mbean = JMX::MBeanServer.new
  cluster = self.cluster_name
  protocols = [] 

  # find the protocols used by 'cluster' 
  filter_str = 'jboss.jgroups:cluster=' + cluster + ',protocol=*,*'

  mbean.query_names( filter_str ).collect do |name|
    protocols << JMX::MBeanServer.new[ name ]
  end

  protocols 
end