Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > drb client-side proxies

Reply
Thread Tools

drb client-side proxies

 
 
Mark Volkmann
Guest
Posts: n/a
 
      08-14-2005
The source file lib\ruby\1.8\drb\drb.rb defines the class DRbObject. I
don't understand the initialize method. Why would I ever want to pass
something other than nil for the first parameter? The comment above
the initialize method says that is used to create a proxy/stub for a
local object. Why would I want to do that?

The typical way to use this is
=20
proxy =3D DRbObject.new(nil, url) =20

--=20
R. Mark Volkmann
Partner, Object Computing, Inc.


 
Reply With Quote
 
 
 
 
Eric Hodel
Guest
Posts: n/a
 
      08-16-2005
On 14 Aug 2005, at 12:40, Mark Volkmann wrote:

> The source file lib\ruby\1.8\drb\drb.rb defines the class DRbObject. I
> don't understand the initialize method. Why would I ever want to pass
> something other than nil for the first parameter? The comment above
> the initialize method says that is used to create a proxy/stub for a
> local object. Why would I want to do that?
>
> The typical way to use this is
>
> proxy = DRbObject.new(nil, url)


You can pass DRbObjects across the wire, so you could wrap a local
object and pass the DRbObject across the wire to the other side. If
you look around in drb.rb you'll see several places where it is used.

--
Eric Hodel - http://www.velocityreviews.com/forums/(E-Mail Removed) - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04



 
Reply With Quote
 
 
 
 
Mark Volkmann
Guest
Posts: n/a
 
      08-16-2005
On 8/15/05, Eric Hodel <(E-Mail Removed)> wrote:
> On 14 Aug 2005, at 12:40, Mark Volkmann wrote:
>=20
> > The source file lib\ruby\1.8\drb\drb.rb defines the class DRbObject. I
> > don't understand the initialize method. Why would I ever want to pass
> > something other than nil for the first parameter? The comment above
> > the initialize method says that is used to create a proxy/stub for a
> > local object. Why would I want to do that?
> >
> > The typical way to use this is
> >
> > proxy =3D DRbObject.new(nil, url)

>=20
> You can pass DRbObjects across the wire, so you could wrap a local
> object and pass the DRbObject across the wire to the other side. If
> you look around in drb.rb you'll see several places where it is used.


Are you saying that this is a way to force a pass by reference?
I can also do that with DRbUndumped.
Are these blocks of code equivalent in what they accomplish?

obj.extend DRbUndumped
remote_obj.some_method(obj)

remote_obj.some_method(DRbObject.new(obj))

--=20
R. Mark Volkmann
Partner, Object Computing, Inc.


 
Reply With Quote
 
Eric Hodel
Guest
Posts: n/a
 
      08-16-2005
On 16 Aug 2005, at 09:15, Mark Volkmann wrote:

> On 8/15/05, Eric Hodel <(E-Mail Removed)> wrote:
>
>> On 14 Aug 2005, at 12:40, Mark Volkmann wrote:
>>
>>
>>> The source file lib\ruby\1.8\drb\drb.rb defines the class
>>> DRbObject. I
>>> don't understand the initialize method. Why would I ever want to
>>> pass
>>> something other than nil for the first parameter? The comment above
>>> the initialize method says that is used to create a proxy/stub for a
>>> local object. Why would I want to do that?
>>>
>>> The typical way to use this is
>>>
>>> proxy = DRbObject.new(nil, url)

>>
>> You can pass DRbObjects across the wire, so you could wrap a local
>> object and pass the DRbObject across the wire to the other side. If
>> you look around in drb.rb you'll see several places where it is used.

>
> Are you saying that this is a way to force a pass by reference?
> I can also do that with DRbUndumped.
> Are these blocks of code equivalent in what they accomplish?
>
> obj.extend DRbUndumped
> remote_obj.some_method(obj)
>
> remote_obj.some_method(DRbObject.new(obj))


Yes.

DRbUndumped overrides _dump which causes a DRbObject to be created
wrapping obj.

--
Eric Hodel - (E-Mail Removed) - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DRB: can't run subshell in drb server? Ittay Dror Ruby 1 10-21-2008 11:28 AM
DRb connection error with more than 250+ DRb services J. Wook Ruby 16 05-16-2007 11:32 AM
More DRb; SSL & DRB & errors Kirk Haines Ruby 0 07-01-2005 06:29 PM
DRb / dRuby - freezes on DRb::DRbUndumped - any ideas? Miles Keaton Ruby 3 03-30-2005 03:37 PM
Proxies, anyone? mad scientist Firefox 3 10-31-2004 05:22 AM



Advertisments