*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RMI:Placing different objects on different ports Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RMI:Placing different objects on different ports" Watch "RMI:Placing different objects on different ports" New topic
Author

RMI:Placing different objects on different ports

Mark O' Sullivan
Ranch Hand

Joined: Aug 17, 2009
Posts: 160
Hi,
Just wondering as regards the RMI part of the assignment, Is it possible in RMI to have multiple objects all in the same registry but all on different ports? I think this is the way servers work in the real world. My problem would be though, how would one, after starting the server and registering an object on a port, test if passed another object whether the server has previously existed or not? Maybe my understanding is wrong here, but is there a difference between a registry object and a server or is 1 object allocated to 1 registry at a time?
Thanks.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4908
    
  10

Hi Mark,

I created a bit of sample code:
This code is not about good design , just to discover with some trail-and-error what happens with RMI.

Things were you can experiment with:
  • run this code 2 times in a row
  • run this code 2 times in a row and change port in between runs
  • add a 2nd call to createRegistry-method before (or in between) calls to bind
  • change call to rebind into a call to bind
  • change "PowerService" to "ComputeService" (or vice versa)
  • combine the 2 previous steps
  • ... (whatever you want to try, just do it)


  • Hope it helps to give you a better understanding of RMI.
    Kind regards,
    Roel


    SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
    http://www.javaroe.be/
    Mark O' Sullivan
    Ranch Hand

    Joined: Aug 17, 2009
    Posts: 160
    Cheers, thanks Roel for that great help. Will try it and let you know how I get on.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: RMI:Placing different objects on different ports
     
    Similar Threads
    multiple databases
    Singleton Pattern
    weird behaviour of singleton pattern in rmi call
    Is an object exported..??
    Q: RMI- send objects, multiple servers