/*     */ private boolean isLocal() /*     */ {
   /* 102 */ boolean bool = false;
   /* 103 */ Delegate localDelegate = StubAdapter.getDelegate(this.stub);
   /*     */
   /* 105 */ if ((localDelegate instanceof CorbaClientDelegate)) {
     /* 106 */ CorbaClientDelegate localCorbaClientDelegate = (CorbaClientDelegate) localDelegate;
     /* 107 */ ContactInfoList localContactInfoList =
         localCorbaClientDelegate.getContactInfoList();
     /* 108 */ if ((localContactInfoList instanceof CorbaContactInfoList)) {
       /* 109 */ CorbaContactInfoList localCorbaContactInfoList =
           (CorbaContactInfoList) localContactInfoList;
       /* 110 */ LocalClientRequestDispatcher localLocalClientRequestDispatcher =
           localCorbaContactInfoList.getLocalClientRequestDispatcher();
       /*     */
       /* 112 */ bool = localLocalClientRequestDispatcher.useLocalInvocation(null);
       /*     */ }
     /*     */ }
   /*     */
   /* 116 */ return bool;
   /*     */ }
Beispiel #2
0
  /**
   * The <tt>isLocal</tt> method has the same semantics as the ObjectImpl._is_local method, except
   * that it can throw a RemoteException. (no it doesn't but the spec says it should.)
   *
   * <p>The <tt>_is_local()</tt> method is provided so that stubs may determine if a particular
   * object is implemented by a local servant and hence local invocation APIs may be used.
   *
   * @param stub the stub to test.
   * @return The <tt>_is_local()</tt> method returns true if the servant incarnating the object is
   *     located in the same process as the stub and they both share the same ORB instance. The
   *     <tt>_is_local()</tt> method returns false otherwise. The default behavior of
   *     <tt>_is_local()</tt> is to return false.
   * @throws RemoteException The Java to IDL specification does to specify the conditions that cause
   *     a RemoteException to be thrown.
   */
  public boolean isLocal(javax.rmi.CORBA.Stub stub) throws RemoteException {
    boolean result = false;

    try {
      org.omg.CORBA.portable.Delegate delegate = stub._get_delegate();
      if (delegate instanceof CorbaClientDelegate) {
        // For the Sun ORB
        CorbaClientDelegate cdel = (CorbaClientDelegate) delegate;
        ContactInfoList cil = cdel.getContactInfoList();
        if (cil instanceof CorbaContactInfoList) {
          CorbaContactInfoList ccil = (CorbaContactInfoList) cil;
          LocalClientRequestDispatcher lcs = ccil.getLocalClientRequestDispatcher();
          result = lcs.useLocalInvocation(null);
        }
      } else {
        // For a non-Sun ORB
        result = delegate.is_local(stub);
      }
    } catch (SystemException e) {
      throw javax.rmi.CORBA.Util.mapSystemException(e);
    }

    return result;
  }