Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI object

 
Jimmy Hu
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is related to the assignment. But I am trying to address it in more general way.
RMI object created in server side cannot take any parameters from client side. What I can think of is to create a member method to take the parameters from client and change the original constructor to do nothing signicant but create a RMI object. The side effect is this imposes some order of executing the member methods of remote object. Do you know the better way to handle it?
Thanks
Jimmy
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jimmy,

RMI object created in server side cannot take any parameters from client side.

Why not? What RMI object are you talking about? You can always use some sort of static factory method to construct objects across RMI.
Michael Morris
 
Jimmy Hu
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the server side of RMI, you create a remote object and then use "Naming.rebind(...)" to publish the remote object. When you create the remote object, "rebind" doesn't happen yet. How do you get some parameters from client side to create the remote object?
E.g. I need the database information to create a a Data object in server side.
Looking forward to your response.
Thanks
Jimmy
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jimmy,
Not all RMI objects have to be bound to the registry with Naming.rebind(). As I was saying you could bind some sort of factory object to the registry which could then create some other RMI object based on parameters passed to it from the client. The parameters of course must be primitives, Serializable or Remote objects.
Hope this helps,
Michael Morris
 
Jimmy Hu
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael,
Thanks for your help.
Looks like my knowledge on RMI is very limited -- only from Sun's RMI tutorial.
I need to read more .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic