JAV2I 1.2 NO IDEA Avatar
  1. OMG Issue

JAV2I12 — Java reverse mapping local case cannot properly support Portable Intercepto

  • Key: JAV2I12-20
  • Legacy Issue Number: 3754
  • Status: closed  
  • Source: Oracle ( Harold Carr)
  • Summary:

    The local mapping makes it impossible to determine which ending point
    to call.

    ptc/00-01-06 says:

    BEGIN_QUOTE

    1.5.2.2 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
    this._servant_preinvoke("echo",Aardvark.class)
    3. If _servant_preinvoke returned a non-null ServantObject so, call
    ((Aardvark)so.servant).echo
    4. If _servant_preinvoke returned a non-null ServantObject so, call
    this._servant_postinvoke(so)
    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.

    // Java
    public class _Aardvark_Stub extends javax.rmi.CORBA.Stub
    implements Aardvark
    {
    public int echo(int x)
    throws java.rmi.RemoteException, Boomerang
    {
    if (!javax.rmi.CORBA.Util.isLocal(this))

    { ... }

    else {
    // local call path
    org.omg.CORBA.portable.ServantObject so =
    _servant_preinvoke("echo", Aardvark.class);
    if (so == null)
    return echo;
    try

    { return ((Aardvark)so.servant).echo(x); }

    catch (Throwable ex)

    { Throwable ex2 = (Throwable) javax.rmi.CORBA.Util.copyObject(ex, _orb()); if (ex2 instanceof Boomerang) throw (Boomerang)ex2; else throw javax.CORBA.Util.wrapException(ex2); }

    finally

    { _servant_postinvoke(so); }

    }
    }
    }

    END_QUOTE

    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
    _servant_preinvoke.)

    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
    case.

  • Reported: JAV2I 1.0b1 — Fri, 21 Jul 2000 04:00 GMT
  • Disposition: Resolved — JAV2I 1.2
  • Disposition Summary:

    see below

  • Updated: Fri, 6 Mar 2015 20:58 GMT