Sha256: 5846c5e7f5fc7d00db876dbd3147decad2963e0857001877bf4f9fc5c3a3cb58
Contents?: true
Size: 1.45 KB
Versions: 5
Compression:
Stored size: 1.45 KB
Contents
# Author:: Nicolas Despres <nicolas.despres@gmail.com>. # Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved. # License:: LGPL # $Id: Server.rb 567 2005-04-13 08:00:06Z polrop $ require 'drb/drb_observable' module TTK module Monitors class Server include DRb::DRbUndumped class Notifier include Observable end # class Notifier module Notification ADD_OBSERVER = :add_observer end # module Notification def initialize(service, monitor, max_observer) @service = service @max_observer = max_observer @mutex = Mutex.new @monitor = monitor @notifier = Notifier.new @notifier.add_observer(@service) end attr_reader :max_observer def count_observers @monitor.count_observers end def add_observer(observer) @mutex.synchronize do if @monitor.count_observers < @max_observer @notifier.changed @notifier.notify_observers(Notification::ADD_OBSERVER) @monitor.add_observer(observer) end end end # List all requests available on this front tester. def requests o = Tester.superclass.new public_methods.select do |meth| not (o.respond_to?(meth) or meth.to_s =~ /^_/) end end def uri @service.uri end end # class Server end # module Monitors end # module TTK
Version data entries
5 entries across 5 versions & 1 rubygems