This discussion is archived
1 Reply Latest reply: Jan 15, 2011 10:56 PM by EJP RSS

Serializing a stub

831518 Newbie
Currently Being Moderated
I'm contemplating the following architecture:
Parent JVM A
Child JVM B
Client JVM C

Process C (the client) will be contacting A using a UnicastRemoteObject in an RMI Registry and delivering a remote callback. At some point A will create a child java proces (B) to process C's request. What I'd like to do is serialize the callback object and pass it from A to B using the OutputStream retrieved from the child's Process object. Then B will do some calculating and send the result to C directly instead of passing the results back to A and having A send them to C.

Googling the topic, I find that long ago there was a class named java.rmi.server.MarshalOutputStream, which one needed to use for this purpose. But that class doesn't exist in later versions of the J2SE.

So my question is can I send that RMI stub to my child process using normal object serialization, or is there some other mechanism that replaces MarshalOutputStream?
  • 1. Re: Serializing a stub
    EJP Guru
    Currently Being Moderated
    What I'd like to do is serialize the callback object
    From your description, what you mean here is to serialize its stub. Stubs are serializable, no problem.
    and pass it from A to B using the OutputStream retrieved from the child's Process object.
    No problem, just wrap it in an ObjectOutputStream.
    Googling the topic, I find that long ago there was a class named java.rmi.server.MarshalOutputStream, which one needed to use for this purpose.
    There was but you didn't need to use it for this purpose.
    So my question is can I send that RMI stub to my child process using normal object serialization
    Yes. If you want to cart a codebase annotation around with it, wrap it in a MarshalledObject.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points