home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book Home Java Distributed Computing Search this book

6.2. Why Do We Need Messages?

This is a perfectly valid question. If we have object-based communication schemes like CORBA and RMI available in the Java environment, why would we have to resort to passing messages, a simple but restrictive communication method, to transmit information between agents?

While message passing isn't as sophisticated and robust as distributed objects, it's relatively simple to implement using the java.io package. The goals of the two approaches are very different. Distributing objects extends an application across the network by making its objects appear to be spread across the hosts in our virtual machine. Message passing serves a much simpler role, defining a simple communication protocol for sending data. Passing messages over I/O streams also avoids the communication overhead involved in using most distributed object schemes, and doesn't require any special network protocols. So message passing is a useful and sometimes necessary tool, particularly in the following situations:

  • Communication needs are relatively simple in nature

  • Transaction throughput is critical

  • The scope of the your system is limited, so that rapid implementation takes precedence over sophistication and flexibility of design

  • Special network protocols need to be avoided (e.g., parts of the system need to operate behind a firewall)

  • Remote object protocols (e.g., an applet in a browser that doesn't support RMI or CORBA) simply aren't available

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.