Sha256: a6bd1560cf8790c367de24157d45f62082beccb816a2547fb6dd891f2c7d13a3

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

#
# Copyright 2011 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

module Backstage
  class Group
    include HasMBean
    include Resource
    
    def self.filter
      "jgroups:cluster=*,type=channel"
    end

    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

    # this shadows Object#open
    def open
      mbean[:open]
    end
    
    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
torquebox-backstage-1.0.5 lib/groups/models/group.rb