No that's not true. If ORB implements local optimization of the object (sometimes "hosted objects"), then it will not open any sockets, but it will perform serialization / deserialization, which is usually faster than sorting. Extreme copies of the object are made so as not to violate the programming model.
Created stubs allow 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)) { } 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 the stub is connected to the local object, it calls ObjectImpl._servant_preinvoke to search for the servant (EJB wrapper in your case) within the same JVM. Then it copies the input arguments (simulates the sort), calls the method and creates a copy of the result object (again simulating the sort).
I am not a WebLogic expert. However, this document assumes that WebLogic optimizes hosted objects:
http://download.oracle.com/docs/cd/E13222_01/wls/docs61/cluster/object.html#1007328
Bret kail
source share