drb client-side proxies

Discussion in 'Ruby' started by Mark Volkmann, Aug 14, 2005.

  1. 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.
     
    Mark Volkmann, Aug 14, 2005
    #1
    1. Advertising

  2. Mark Volkmann

    Eric Hodel Guest

    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://segment7.net
    FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04
     
    Eric Hodel, Aug 16, 2005
    #2
    1. Advertising

  3. On 8/15/05, Eric Hodel <> 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.
     
    Mark Volkmann, Aug 16, 2005
    #3
  4. Mark Volkmann

    Eric Hodel Guest

    On 16 Aug 2005, at 09:15, Mark Volkmann wrote:

    > On 8/15/05, Eric Hodel <> 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 - - http://segment7.net
    FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04
     
    Eric Hodel, Aug 16, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Boss302
    Replies:
    0
    Views:
    1,109
    Boss302
    Nov 21, 2006
  2. Miles Keaton
    Replies:
    3
    Views:
    205
    Miles Keaton
    Mar 30, 2005
  3. Kirk Haines

    More DRb; SSL & DRB & errors

    Kirk Haines, Jul 1, 2005, in forum: Ruby
    Replies:
    0
    Views:
    150
    Kirk Haines
    Jul 1, 2005
  4. J. Wook
    Replies:
    16
    Views:
    306
    Robert Klemme
    May 16, 2007
  5. Ittay Dror
    Replies:
    1
    Views:
    154
    Ittay Dror
    Oct 21, 2008
Loading...

Share This Page