Search code examples
javarmi

Dynamic Object Creation with RMI


I would like to make a project with RMI, but I would like to know this. Is it possible to create new remote objects on demand while the server is operating? If so, is there anything special needed?


Solution

  • The short answer is, yes.

    There are some caverts though.

    1. The object begin returned to the client must implement a interface that the client has access to
    2. The object begin returned must implement the Remote interface (or implement an interface that extends from Remote)

    Basically, the object the is "exported" to the RMI server would act as a factory that the client would be able to call and it would then create what ever new remote objects it required.