• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI and it's unknown ways

 
Adrian Muscalu
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I was testing my application and I've discovered that after calling <b>unbind</b> and checking with <b>list</b> that the RMI registry doesn't contain the entry for my remote object, the clients can still invoke methods on the remote object at their leisure. No exceptions are thrown!!!

However, new clients get an exception (which is the right behaviour) upon trying to get a remote object.
Moreover, if I close the Server application completely than I do get the expected behaviour, the clients (new or old) will get an exception.

Now, I could close the server all the time without fancying around with <b>unbind</b> but I am afraid that I am only hiding a bigger problem; maybe my RMI approach is not the right one.

My remote object has an instance variable which is the Data class. All clients are expected to get stubs that point to the same instance of the remote object.

I am thinking that the Data class was passed somehow by copy and not by reference to the client.

Testing is done in the same JVM, on the same machine.

Any ideas on why this might happen?

Thank you all in advance,
Adrian
 
rinke hoekstra
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the clients can still invoke methods on the remote object at their leisure. No exceptions are thrown!!!


Don't know, still have to start with the RMI part and dive in to it. Are you sure that your classpath is not simply pointing to the remote object so that it just has access to it bypassing RMI?
 
Adrian Muscalu
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, I am sure.
Thanks for replying.
 
Mark Smyth
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Adrian Muscalu:
Hi everyone,

I was testing my application and I've discovered that after calling <b>unbind</b> and checking with <b>list</b> that the RMI registry doesn't contain the entry for my remote object, the clients can still invoke methods on the remote object at their leisure. No exceptions are thrown!!!

However, new clients get an exception (which is the right behaviour) upon trying to get a remote object.
Moreover, if I close the Server application completely than I do get the expected behaviour, the clients (new or old) will get an exception.

Now, I could close the server all the time without fancying around with <b>unbind</b> but I am afraid that I am only hiding a bigger problem; maybe my RMI approach is not the right one.

My remote object has an instance variable which is the Data class. All clients are expected to get stubs that point to the same instance of the remote object.

I am thinking that the Data class was passed somehow by copy and not by reference to the client.

Testing is done in the same JVM, on the same machine.

Any ideas on why this might happen?

Thank you all in advance,
Adrian


This is the correct behavior for RMI to the best of my knowledge.

When you unbind the remote object it means that new clients cannot obtain a reference to that remote object using the RMI registry. However unbind does not destroy the object it just means that prospective new clients can no longer use the RMI registry to access it.

As the existing client already have a obtained a reference to the remote object they can continue to use it as normal. While all these existing remote client references remain the remote object will continue to exist.

Mark
[ July 11, 2007: Message edited by: Mark Smyth ]
 
Adrian Muscalu
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

Thanks for taking the time to answer.
It is a relief to know that I haven't misused RMI and the program behaves as expected.

Cheers,
Adrian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic