File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RMI vs. Sockets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RMI vs. Sockets" Watch "RMI vs. Sockets" New topic
Author

RMI vs. Sockets

Marre Mask
Greenhorn

Joined: May 04, 2001
Posts: 19
I have problem finding good reason to why I choose RMI intead of Sockets. My only reason to why I choose RMI instead of Sockets is that I thought it would be more interesting to try a new technic. Please give me som feedback on the more technical approach to why you should use RMI instead of Sockets.
death pac
Greenhorn

Joined: Jun 15, 2001
Posts: 12
hi mask ,
please read my previos post (passed 148/155) i've listed out five points listing out the advantages of RMI over sockets.

amjad
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
My take on it was:

  • The requirement states that you need to develop a remote version of Data implementing the same interface. A socket-based protocol would mean that object would have to translate calls to the underlying protocol, and vice versa at the server end. RMI gives you this for free: the remote stub can be exactly the RemoteData implementation.
  • The RMI distributed garbage collection feature can be leveraged to clean up the locks of dead clients. With sockets you would have to explicitly expire the locks.
  • RMI has implemented the required multi-threaded server for you in an efficient way. To achieve comparable performance with a socket protocol, you would need to use thread pools and the like.

  • The first and second of these reasons are dependent on the fairly unusual design I chose.
    - Peter

    [This message has been edited by Peter den Haan (edited July 18, 2001).]
David Qiu
Greenhorn

Joined: May 14, 2001
Posts: 8
hi Haan,
If i want to use dgc to control the dead lock of the client, do i need to make DataInfo implements a remote interface? and another concern is that do i have to bind all the records when the server starts? thanks
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by David Qiu:
If i want to use dgc to control the dead lock of the client, do i need to make DataInfo implements a remote interface? and another concern is that do i have to bind all the records when the server starts? thanks

No. The database server implements the Remote interface, that's all. Everything else gets passed by value. (YMMV: in my particular design, I did not expose a database server, but a connection factory and a connection, both implementing Remote).
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI vs. Sockets
 
Similar Threads
RMI Vs Sockets
Use of sockets through RMI
Essay preparation
passed 148/155 :-))))
need some advice how to prepare for essay exam