No, it is not true. If the ORB implements local object optimization (sometimes "collocated objects"), then it will not open any sockets, but it will perform serialization/deserialization, which is typically faster than marshalling. The extra object copies are made to avoid violating the programming model.
Generated stubs enable this optimization. Here is an example interface:
public interface a extends Remote {
public ArrayList test(ArrayList in1, ArrayList in2) throws RemoteException;
}
Here is the result of rmic -iiop -keep a:
public ArrayList test(ArrayList arg0, ArrayList arg1) throws java.rmi.RemoteException {
if (!Util.isLocal(this)) {
/* ... trim remote code ... */
} else {
ServantObject so = _servant_preinvoke("test",a.class);
if (so == null) {
return test(arg0, arg1);
}
try {
Object[] copies = Util.copyObjects(new Object[]{arg0,arg1},_orb());
ArrayList arg0Copy = (ArrayList) copies[0];
ArrayList arg1Copy = (ArrayList) copies[1];
ArrayList result = ((a)so.servant).test(arg0Copy, arg1Copy);
return (ArrayList)Util.copyObject(result,_orb());
} catch (Throwable ex) {
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
throw Util.wrapException(exCopy);
} finally {
_servant_postinvoke(so);
}
}
}
When a stub is connected to a local object, it calls ObjectImpl._servant_preinvoke to locate a servant (an EJB wrapper in your case) within the same JVM. Then, it makes a copy of the input arguments (simulating marshalling), calls the method, and makes a copy of the result object (again simulating marshalling).
I am not a WebLogic expert. That said, this document implies that WebLogic performs the collocated object optimization:
http://download.oracle.com/docs/cd/E13222_01/wls/docs61/cluster/object.html#1007328