I found what I think to be a bug in the Kaffe implementation of RMI. This applies at least to kaffe 1.1.0 and CVS of 2003-07-21.
Return values of remote invocations are systematically serialized. This does not conform to Sun's specifications: objects that are remote should be replaced by the stub. This have been made for parameters, but not for return values.
In order to fix this, the Unicast.Server class can be modified, and especially its incomingMessageCall(UnicastConnection) method. I think a better solution would be to modify the RMIObjectOutputStream class and to use the object replacement mechanism of the ObjectOutputStream class.
I join a patch file for libraries/javalib/kaffe/rmi/server/RMIObjectOutputStream.java . Of course, the object replacement that reside in the UnicastRef class, method invokeCommon(Remote, Method, Object[], int, long) can be removed since it is handled by the RMIObjectOutputStream.
Sincerely, Jeremy Buisson
14a15
> import java.rmi.server.UnicastRemoteObject;
20a22
> enableReplaceObject(true);
27a30,42
> protected Object replaceObject(Object obj) throws IOException {
> Object ret;
> if(obj instanceof UnicastRemoteObject) {
> ret = UnicastRemoteObject.exportObject((UnicastRemoteObject)obj);
> }
> else {
> ret = obj;
> }
> return ret;
> };
>
>
>
