HORB Serialization Patch
Alpha version 1.2a

by
Luis F. G. Sarmenta (lfgs@cag.lcs.mit.edu)
3 December 1998
Download

What's New

Features

This patch allows HORB to use the built-in object serializer in JDK 1.1 for transferring objects that implement the java.io.Serializable interface. Its benefits and features include:

Files

The following source files have been changed or added. Corresponding class files (compiled with JDK 1.1.7a) are provided for your convenience:

Files under horb\classsrc

Modified classes

New classes

Code snippets

Unrelated modified/new classes

The following classes have changes that are not directly connected to the Serialization patch. However, some of these have other useful fixes so I include them here.

Example directories under horb\examples\serialization\

Other files under horb\serpatch\

How to Use

  1. Unzipping the files. Download the file horbs12.zip and unzip in the horb directory.  The files listed above should be created in their respective subdirectories. The class files should be created in corresponding subdir under horb (i.e., horb\orb and horb\horbc).
  2. Using Serializable objects. If you have an object that is only used as a parameter or return value, and whose methods are not called remotely, then you don't need to run horbc on it. Simply add implements java.io.Serializable to the class definition. (If you need to call some methods of your object remotely, you still need to run horbc.)
  3. Enabling Serialization on the Server.

  4. From the command-line, instead of simply entering:
       >horb
    instead enter
       >horb -ioci horb.orb.SerializingIOCI
    to tell HORB to use SerializingIOCI instead of the normal BasicIOCI.

    If you are starting a HORBServer within an application instead of the command-line, add the line
       horb.orb.HORB.useSerialization();
    before you start the HORBServer. This will enable Serialization if available.

  5. Enabling Serialization on the Client.

  6. Before creating any Proxy's or connecting to any server, add:
       horb.orb.HORB.useSerialization();
  7. Using non-Serializable objects. Compile with horbc as with original HORB.
  8. Using mixed-mode objects. Add implements java.io.Serializable to the class definition and compile with horbc as well. Such objects will use built-in Serialization if available, but will use HORB serialization otherwise. (If you do not compile with horbc, then your code will only work with JDK 1.1 and above.)
  9. Using hooks. You can use _freezeHook() and _reviveHook() as before. However, if you use them in a Serializable object, you must define readObject() and writeObject() methods to call the hooks. You can do this by simply insert the file HookSerializer.java into your code.
  10. Using horb.orb.HORBSerializable.  Some basic HORB classes (specifically horb.orb.Proxy and horb.orb.HorbURL) are now Serializable.  However, for more backward-compatibility, they do not extend/implement java.io.Serializable directly, but instead implement horb.orb.HORBSerializable which extends java.io.Serializable.  If you are using an old version of Java and are having problems compiling code, edit HORBSerializable to make it extend nothing, and then recompile HORBSerializable.
  11. Serializing Primitive Arrays.  By default, SerializingIOCI uses Serialization, if available, for transferring arrays of primitive types.  You can change this default by calling horb.orb.HORB.useSerialization(arg) where the boolean arg is set to true to turn on JDK Serialization of primitive arrays (default), or false to turn primitive array Serialization off.  In general, it is best if you do this on both the server and the client.  (More specifically, a receiver with array serialization turned on can accept arrays with or without serialization, but a sender with array serialization turned on must have a receiver with array serialization turned on as well.)

 Known Limitations

Please let me (lfgs@cag.lcs.mit.edu) know if you learn more about these problems, or find new bugs/problems.
 

History

Alpha releases

Future Work

Here are some possible directions for future work on this patch.  I am not sure when I can find the time to do these, so if you can help with these, it would be great!  Please send your contributions to me, or to Hirano-san (hirano@etl.go.jp) or to the HORBOpen list (horbopen@horb.org).

Disclaimer

This patch package is distributed as alpha-version software.  While I believe that it is reasonably safe and usable in most situations, I make no guarantees whatsover, and shall not be held responsible for any direct or indirect damage that may be caused by the use of this package.   Your bug-reports and suggestions are most welcome.  Please send email to the addresses above.