1.

Normally In The Java Programming Language, It Is Possible To Cast An Interface Instance To An Instance Of The Class From Which It Was Created And Use The Result. Why Doesn't This Work In Rmi?

Answer»

In RMI the CLIENT sees only a stub for the original object. The stub implements only the remote interfaces and their remote METHODS and cannot be cast back to the original implementation CLASS because it's just a stub. So, you cannot PASS a remote object reference from a server to a client, and then send it back to the server and be able to cast it back to the original implementation class. You can, though, use the remote object reference on the server to make a remote call to the object. If you need to find the implementation class again, you'll need to KEEP a table that maps the remote reference to the implementation class.

In RMI the client sees only a stub for the original object. The stub implements only the remote interfaces and their remote methods and cannot be cast back to the original implementation class because it's just a stub. So, you cannot pass a remote object reference from a server to a client, and then send it back to the server and be able to cast it back to the original implementation class. You can, though, use the remote object reference on the server to make a remote call to the object. If you need to find the implementation class again, you'll need to keep a table that maps the remote reference to the implementation class.



Discussion

No Comment Found