The local mapping makes it impossible to determine which ending point
188.8.131.52 Local Stubs
The stub class may provide an optimized call path for local server
implementation objects. For a method echo(int x) of a remote interface
Aardvark, the optimized path does the following:
1. Find out if the servant is local by calling Util.isLocal()
2. If the servant is local, call
3. If _servant_preinvoke returned a non-null ServantObject so, call
4. If _servant_preinvoke returned a non-null ServantObject so, call
5. If _servant_preinvoke returned null, repeat step 1. The call to
Util.isLocal() will return false, causing the non-optimized
path to be followed.
The following is an example of a stub class that provides this
optimized call path.
public class _Aardvark_Stub extends javax.rmi.CORBA.Stub
public int echo(int x)
throws java.rmi.RemoteException, Boomerang
// local call path
org.omg.CORBA.portable.ServantObject so =
if (so == null)
catch (Throwable ex)
Throwable ex2 = (Throwable)
if (ex2 instanceof Boomerang)
ClientRequestInterceptor::send_request would need to be invoked by the
ORB inside _servant_preinvoke.
ClientRequestInterceptor::receive_reply or receive_exception would
need to be called inside _servant_postinvoke.
(Note that receive_other would not happen since, if a POA were
involved inside _servant_preinvoke and a servant manager raised
ForwardRequest, this should cause _servant_preinvoke to return null
resulting in a recursive call to the method. In this case the ORB
would not call send_request in the first place, or, if it did, it
would handle the call to the receive_other internally inside of
One is tempted to say that the ORB could remember if
javax.rmi.CORBA.Util.copyObject was called on behalf of this request.
In that case, when _servant_postinvoke is called it would know there
was an exception (and would have it hands on the exception object -
which needs to be available via Portable Interceptors).
However, this does not work. The example does not show it, but if the
method returns values those values are filtered through
javax.rmi.CORBA.Util.copyObject before being returned to the client.
Exception objects are legal return values. So there is no way to
determine if copyObject was called to copy return values or exception
objects resulting from an actually exception. Therefore this trick
will not work.
Bottom line: there is no reliable way to determine which Portable
Interceptor ending point to call in the Java reverse mapping local