Implementing User-Defined Objects in Java Clients
You can use one of two methods to implement a user-defined object in a Java client that works with C++ clients:
Instantiator.register method, a client sends a
RegistrationMessage to every Java VM in its distributed system. The message announces the mapping between a user-defined classId and class name. The other JVMs can deserialize the byte array with the correct class.
DataSerializable method, the user-defined object is serialized into the following byte array:
45 <2-byte-length> <class-name>
A Java client can deserialize the byte array, but a C++ client cannot convert the Java class name to a C++ class name.
DataSerializable method does not support using a nested object, while
Instantiator.register does support the use of nested objects. A workaround is to let each Java client manually initiate an object for each possible user object class a C++ client provides, using the following code:
User u = new User("", 0);
See Java Serialization Example for a code sample that shows how to set up user object classes in a Java client.