Search code examples
javajndirmi

Do the rmiregistry or JNDI store the object in serialized form


I read that I can use the rmiregistry or JNDI as a directory service for RMI. As far as I understood, the stub for remote objects is stored and associated with a key in such a directory service.

Now my question is, is the stub stored in serialized form or as an "active" object in the rmiregistry/JNDI?

If it stored serialized wouldn't the distributed garbage collection fail?


Solution

  • I read that I can use the rmiregistry or JNDI as a directory service for RMI.

    No you didn't. You read that you can use the Registry as a directory service, and JNDI as an API for it.

    As far as I understood, the stub for remote objects is stored and associated with a key in such a directory service.

    Correct.

    Now my question is, is the stub stored in serialized form or as an "active" object in the rmiregistry/JNDI?

    It is serialized to the Registry and deserialized on arrival (unmarshalling). Inside the Registry it is a normal Java object.

    if it is stored serialized ...

    It isn't.

    JNDI really has nothing to do with it.