| Module | DRb |
| In: |
lib/drb/eq.rb
lib/drb/extservm.rb lib/drb/drb.rb lib/drb/ssl.rb lib/drb/observer.rb lib/drb/gw.rb lib/drb/invokemethod.rb lib/drb/unix.rb lib/drb/timeridconv.rb lib/drb/extserv.rb |
for ruby-1.8.0
| primary_server | [RW] |
The primary local dRuby server.
This is the server created by the start_service call. |
Get the configuration of the current server.
If there is no current server, this returns the default configuration. See current_server and DRbServer::make_config.
# File lib/drb/drb.rb, line 1684
1684: def config
1685: current_server.config
1686: rescue
1687: DRbServer.make_config
1688: end
Get the ‘current’ server.
In the context of execution taking place within the main thread of a dRuby server (typically, as a result of a remote call on the server or one of its objects), the current server is that server. Otherwise, the current server is the primary server.
If the above rule fails to find a server, a DRbServerNotFound error is raised.
# File lib/drb/drb.rb, line 1648
1648: def current_server
1649: drb = Thread.current['DRb']
1650: server = (drb && drb['server']) ? drb['server'] : @primary_server
1651: raise DRbServerNotFound unless server
1652: return server
1653: end
Get the front object of the current server.
This raises a DRbServerNotFound error if there is no current server. See current_server.
# File lib/drb/drb.rb, line 1695
1695: def front
1696: current_server.front
1697: end
Set the default acl.
See DRb::DRbServer.default_acl.
# File lib/drb/drb.rb, line 1737
1737: def install_acl(acl)
1738: DRbServer.default_acl(acl)
1739: end
Set the default id conv object.
See DRbServer#default_id_conv.
# File lib/drb/drb.rb, line 1729
1729: def install_id_conv(idconv)
1730: DRbServer.default_id_conv(idconv)
1731: end
# File lib/drb/drb.rb, line 1743
1743: def regist_server(server)
1744: @server[server.uri] = server
1745: Thread.exclusive do
1746: @primary_server = server unless @primary_server
1747: end
1748: end
# File lib/drb/drb.rb, line 1751
1751: def remove_server(server)
1752: @server.delete(server.uri)
1753: end
Start a dRuby server locally.
The new dRuby server will become the primary server, even if another server is currently the primary server.
uri is the URI for the server to bind to. If nil, the server will bind to random port on the default local host name and use the default dRuby protocol.
front is the server‘s front object. This may be nil.
config is the configuration for the new server. This may be nil.
See DRbServer::new.
# File lib/drb/drb.rb, line 1627
1627: def start_service(uri=nil, front=nil, config=nil)
1628: @primary_server = DRbServer.new(uri, front, config)
1629: end
Stop the local dRuby server.
This operates on the primary server. If there is no primary server currently running, it is a noop.
# File lib/drb/drb.rb, line 1660
1660: def stop_service
1661: @primary_server.stop_service if @primary_server
1662: @primary_server = nil
1663: end
Get a reference id for an object using the current server.
This raises a DRbServerNotFound error if there is no current server. See current_server.
# File lib/drb/drb.rb, line 1712
1712: def to_id(obj)
1713: current_server.to_id(obj)
1714: end
Convert a reference into an object using the current server.
This raises a DRbServerNotFound error if there is no current server. See current_server.
# File lib/drb/drb.rb, line 1704
1704: def to_obj(ref)
1705: current_server.to_obj(ref)
1706: end
Get the URI defining the local dRuby space.
This is the URI of the current server. See current_server.
# File lib/drb/drb.rb, line 1669
1669: def uri
1670: current_server.uri
1671: end