⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 localrequest.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                    Any a = new gnuAny();                    OutputStream buf = getBuffer();                    InputStream in = buf.create_input_stream();                    String uex_idl = "unknown";                    try                      {                        in.mark(Integer.MAX_VALUE);                        uex_idl = in.read_string();                        m_exception_id = uex_idl;                        in.reset();                      }                    catch (IOException e)                      {                        throw new Unexpected(e);                      }                    try                      {                        UserException exception =                          ObjectCreator.readUserException(uex_idl, in);                        m_environment.exception(exception);                        ObjectCreator.insertWithHelper(a, exception);                      }                    catch (Exception e)                      {                        // Failed due any reason, insert without                        // helper.                        a.insert_Streamable(new StreamHolder(                            buf.create_input_stream()                          )                        );                        RecordTypeCode r =                          new RecordTypeCode(TCKind.tk_except);                        r.setId(uex_idl);                        r.setName(ObjectCreator.getDefaultName(uex_idl));                      }                    s_info.m_usr_exception = a;                    c_info.m_wrapped_exception = a;                    s_interceptor.send_exception(s_info);                    c_interceptor.receive_exception(c_info);                  }                else                  {                    if (s_intercept)                      {                        s_info.m_reply_header.reply_status =                          ReplyHeader.NO_EXCEPTION;                        s_interceptor.send_reply(s_info);                      }                    if (c_intercept)                      {                        m_rph.reply_status = ReplyHeader.NO_EXCEPTION;                        c_interceptor.receive_reply(c_info);                      }                  }              }            catch (SystemException sys_ex)              {                if (s_intercept)                  {                    s_info.m_reply_header.reply_status =                      ReplyHeader.SYSTEM_EXCEPTION;                    s_info.m_sys_exception = sys_ex;                    s_interceptor.send_exception(s_info);                  }                if (c_intercept)                  {                    m_rph.reply_status = ReplyHeader.SYSTEM_EXCEPTION;                    Any a = new gnuAny();                    if (ObjectCreator.insertSysException(a, sys_ex))                      {                        c_info.m_wrapped_exception = a;                      }                    c_interceptor.receive_exception(c_info);                  }                throw sys_ex;              }          }        finally          {            ORB o = orb();            if (o instanceof ORB_1_4)              {                ((ORB_1_4) o).currents.remove(Thread.currentThread());              }          }        if (poa.servant_locator != null)          {            poa.servant_locator.postinvoke(object.Id, poa, operation(),              cookie.value, object.getServant()            );          }        return buffer.create_input_stream();      }    catch (ForwardRequest fex)      {        // May be thrown by interceptor.        if (s_intercept)          {            Forwarding:            while (true)              {                s_info.m_reply_header.reply_status =                  ReplyHeader.LOCATION_FORWARD;                s_info.m_forward_reference = fex.forward;                try                  {                    s_interceptor.send_other(s_info);                    break Forwarding;                  }                catch (ForwardRequest fex2)                  {                    s_info.m_forward_reference = fex2.forward;                    fex.forward = s_info.m_forward_reference;                  }              }          }        if (c_intercept)          {            this.m_rph.reply_status = ReplyHeader.LOCATION_FORWARD;            this.m_forwarding_target = fex.forward;            try              {                c_interceptor.receive_other(c_info);              }            catch (ForwardRequest fex2)              {                fex.forward = fex2.forward;              }          }        throw new gnuForwardRequest(fex.forward);      }    catch (gnuForwardRequest fex)      {        // May be thrown during activation.        // May be thrown during activation.        if (s_intercept)          {            Forwarding:            while (true)              {                s_info.m_reply_header.reply_status =                  ReplyHeader.LOCATION_FORWARD;                s_info.m_forward_reference = fex.forward_reference;                try                  {                    s_interceptor.send_other(s_info);                    break Forwarding;                  }                catch (ForwardRequest fex2)                  {                    s_info.m_forward_reference = fex2.forward;                    fex.forward_reference = (ObjectImpl) fex2.forward;                  }              }          }        if (c_intercept)          {            this.m_rph.reply_status = ReplyHeader.LOCATION_FORWARD;            this.m_forwarding_target = fex.forward_reference;            try              {                c_interceptor.receive_other(c_info);              }            catch (ForwardRequest fex2)              {                fex.forward_reference = (ObjectImpl) fex2.forward;              }          }        throw fex;      }  }  /**   * Make an invocation and store the result in the fields of this Request. Used   * with DII only.   */  public void invoke()  {    InvokeHandler handler = object.getHandler(operation(), cookie, false);    if (handler instanceof DynamicImpHandler)      {        DynamicImplementation dyn = ((DynamicImpHandler) handler).servant;        if (serverRequest == null)          {            serverRequest = new LocalServerRequest(this);          }        try          {            poa.m_orb.currents.put(Thread.currentThread(), this);            dyn.invoke(serverRequest);          }        finally          {            poa.m_orb.currents.remove(Thread.currentThread());          }      }    else      {        org.omg.CORBA.portable.InputStream input = v_invoke(handler);        if (!exceptionReply)          {            NamedValue arg;            // Read return value, if set.            if (m_result != null)              {                m_result.value().read_value(input, m_result.value().type());              }            // Read returned parameters, if set.            if (m_args != null)              {                for (int i = 0; i < m_args.count(); i++)                  {                    try                      {                        arg = m_args.item(i);                        // Both ARG_INOUT and ARG_OUT have this binary flag set.                        if ((arg.flags() & ARG_OUT.value) != 0)                          {                            arg.value().read_value(input, arg.value().type());                          }                      }                    catch (Bounds ex)                      {                        Unexpected.error(ex);                      }                  }              }          }        else// User exception reply          {            // Prepare an Any that will hold the exception.            gnuAny exc = new gnuAny();            exc.insert_Streamable(new StreamHolder(input));            UnknownUserException unuex = new UnknownUserException(exc);            m_environment.exception(unuex);          }      }  }  /**   * Get an output stream for providing details about the exception. Before   * returning the stream, the handler automatically writes the message header   * and the reply about exception header, but not the message header.   *   * @return the stream to write exception details into.   */  public OutputStream createExceptionReply()  {    exceptionReply = true;    prepareStream();    return buffer;  }  /**   * Get an output stream for writing a regular reply (not an exception).   *   * Before returning the stream, the handler automatically writes the regular   * reply header, but not the message header.   *   * @return the output stream for writing a regular reply.   */  public OutputStream createReply()  {    exceptionReply = false;    prepareStream();    return buffer;  }  /**   * Get the buffer, normally containing the written reply. The reply includes   * the reply header (or the exception header) but does not include the message   * header.   *   * The stream buffer can also be empty if no data have been written into   * streams, returned by {@link #createReply()} or   * {@link #createExceptionReply()}.   *   * @return the CDR output stream, containing the written output.   */  BufferedCdrOutput getBuffer()  {    return buffer;  }  /**   * True if the stream was obtained by invoking {@link #createExceptionReply()},   * false otherwise (usually no-exception reply).   */  boolean isExceptionReply()  {    return exceptionReply;  }  /**   * Compute the header offset, set the correct version number and codeset.   */  private void prepareStream()  {    buffer = new BufferedCdrOutput();    buffer.setOrb(orb());  }  /**   * Get the parameter stream, where the invocation arguments should be written   * if they are written into the stream directly.   */  public StreamBasedRequest getParameterStream()  {    m_parameter_buffer = new StreamBasedRequest();    m_parameter_buffer.request = this;    m_parameter_buffer.setOrb(poa.orb());    return m_parameter_buffer;  }  public byte[] get_object_id() throws NoContext  {    return Id;  }  public POA get_POA() throws NoContext  {    return poa;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -