$55 GRAYBYTE WORDPRESS FILE MANAGER $77

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.23
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/ruby18/lib64/ruby/1.8/drb/

HOME
Current File : /opt/alt/ruby18/lib64/ruby/1.8/drb//extservm.rb
=begin
 external service manager
 	Copyright (c) 2000 Masatoshi SEKI 
=end

require 'drb/drb'
require 'thread'
require 'monitor'

module DRb
  class ExtServManager
    include DRbUndumped
    include MonitorMixin

    @@command = {}

    def self.command
      @@command
    end

    def self.command=(cmd)
      @@command = cmd
    end
      
    def initialize
      super()
      @cond = new_cond
      @servers = {}
      @waiting = []
      @queue = Queue.new
      @thread = invoke_thread
      @uri = nil
    end
    attr_accessor :uri

    def service(name)
      synchronize do
        while true
          server = @servers[name]
          return server if server && server.alive?
          invoke_service(name)
          @cond.wait
        end
      end
    end

    def regist(name, ro)
      synchronize do
        @servers[name] = ro
        @cond.signal
      end
      self
    end
    
    def unregist(name)
      synchronize do
	@servers.delete(name)
      end
    end

    private
    def invoke_thread
      Thread.new do
	while true
	  name = @queue.pop
	  invoke_service_command(name, @@command[name])
	end
      end
    end

    def invoke_service(name)
      @queue.push(name)
    end

    def invoke_service_command(name, command)
      raise "invalid command. name: #{name}" unless command
      synchronize do
	return if @servers.include?(name)
	@servers[name] = false
      end
      uri = @uri || DRb.uri
      if RUBY_PLATFORM =~ /mswin32/ && /NT/ =~ ENV["OS"]
        system(%Q'cmd /c start "ruby" /b #{command} #{uri} #{name}')
      else
	system("#{command} #{uri} #{name} &")
      end
    end
  end
end


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.48 PM
root / root
0755
acl.rb
2.581 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
drb.rb
52.199 KB
3 Jul 2009 12.40 AM
root / linksafe
0644
eq.rb
0.247 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
extserv.rb
1.056 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
extservm.rb
1.601 KB
13 Nov 2007 1.04 PM
root / linksafe
0644
gw.rb
1.88 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
invokemethod.rb
0.757 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
observer.rb
0.36 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
ssl.rb
4.897 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
timeridconv.rb
1.472 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
unix.rb
2.429 KB
6 Jun 2012 5.20 AM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF