In Part 1: Write your own threaded discussion forum, we built the 1.0.2 client application, and in Part 2: The communications and server components, we developed the client-side networking and the server for 1.0.2. In Part 3: Scale an application from two to three tiers with JDBC, we converted the server to a JDK 1.1 middleware layer that communicated with an SQL Server database via JDBC. The 1.0.2 client continued to communicate with the middleware layer via sockets. Take a moment to review these versions, and I'll wait for you here....
Object serialization is a facility that enables objects to be "flattened" into and out of ObjectOutputStreams, so that they can be stored in a file, sent across a network, or any number of other things. This flattening is accomplished
by attaching an ObjectOutputStream to an appropriate lower-level OutputStream, such as a FileOutputStream, and writing the object into it. An instance of ObjectInputStream is then used to resurrect the object from the corresponding lower-level InputStream. Object serialization is a wonderful capability because it enables us to deal with live objects as objects instead of having to constantly break them into parts manually to transport or store them. We're going to use object serialization
to clean up the loading and saving of the Forum server's article database. Object serialization facilities are contained in
the java.io package.
RMI in-depth
RMI is used to transport method calls from a local client to a remote RMI server, which is a special object located on a remote
machine. The RMI server usually extends java.rmi.server.UnicastRemoteObject and must implement at least one programmer-defined interface that itself is derived from the java.rmi.Remote "marker" interface. The methods declared in the derived interface will be the methods that the RMI server will export.
ObjectOutputStream Documentation http://www.javasoft.com/products/jdk/1.1/docs/api/java.io.ObjectOutputStream.html#_top_
ObjectInputStream Documentation http://www.javasoft.com/products/jdk/1.1/docs/api/java.io.ObjectInputStream.html#_top_