what is stub on the “server” and what does skeleton mean?

前端 未结 7 717
夕颜
夕颜 2021-01-01 13:34

What does stub do on the server side ? And what is a skeleton ?

\"from

Th

7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-01 14:14

    I'll only address the question of why the stub needs to be on the server side as well as the client side. Th other question has already been answered.

    When an exported remote object is passed to a remote object, as either a method argument or a returned value, the following happens. A stub is created on the server machine. Then it is serialized, sent across the net to the client machine, and deserialized there to make an identical copy of the stub. After that, the stub is no longer needed on the client machine.

    Here is a typical scenario.

    • On machine S, an object s is created and exported.
      • Part of export is to create a stub for s; call is ss0.
    • Machine S calls Naming.bind with s as argument.
      • The server side stub ss0 is serialized and sent to the registry's machine R.
      • The serialized version of ss0 is used to create a copy of ss0 R; call it ss1.
      • The registry on R keeps a pointer to ss1.

    So one use of having a stub on the server side is so that it can be serialized and (a copy of it) sent to other machines, for example as part of binding. In a similar way, when a client does a lookup, the registry serializes a its copy (ss1) and sends it to to client.

提交回复
热议问题