예제 #1
0
 public void onSimpleText_async(
     SimpleText_t text,
     ITerminal_AsyncCallBack async,
     HashMap<String, String> props,
     Object cookie)
     throws RpcException {
   boolean r_5 = false;
   RpcMessage m_6 = new RpcMessage(RpcMessage.CALL | RpcMessage.ASYNC);
   m_6.ifidx = 0;
   m_6.opidx = 0;
   m_6.paramsize = 1;
   m_6.extra.setProperties(props);
   m_6.cookie = cookie;
   try {
     ByteArrayOutputStream bos_7 = new ByteArrayOutputStream();
     DataOutputStream dos_8 = new DataOutputStream(bos_7);
     text.marshall(dos_8);
     m_6.paramstream = bos_7.toByteArray();
     m_6.prx = this;
     m_6.async = async;
   } catch (Exception e) {
     throw new RpcException(RpcConsts.RPCERROR_DATADIRTY, e.toString());
   }
   r_5 = this.conn.sendMessage(m_6);
   if (!r_5) {
     throw new RpcException(RpcConsts.RPCERROR_SENDFAILED);
   }
 }
예제 #2
0
 public void onSimpleText_oneway(SimpleText_t text, HashMap<String, String> props)
     throws RpcException {
   boolean r_1 = false;
   RpcMessage m_2 = new RpcMessage(RpcMessage.CALL | RpcMessage.ONEWAY);
   m_2.ifidx = 0;
   m_2.opidx = 0;
   m_2.paramsize = 1;
   m_2.extra.setProperties(props);
   try {
     ByteArrayOutputStream bos_3 = new ByteArrayOutputStream();
     DataOutputStream dos_4 = new DataOutputStream(bos_3);
     text.marshall(dos_4);
     m_2.paramstream = bos_3.toByteArray();
     m_2.prx = this;
   } catch (Exception e) {
     throw new RpcException(RpcConsts.RPCERROR_DATADIRTY, e.toString());
   }
   r_1 = this.conn.sendMessage(m_2);
   if (!r_1) {
     throw new RpcException(RpcConsts.RPCERROR_SENDFAILED);
   }
 }
예제 #3
0
 // timeout - msec ,  0 means waiting infinitely
 public void onSimpleText(SimpleText_t text, int timeout, HashMap<String, String> props)
     throws RpcException {
   boolean r_1 = false;
   RpcMessage m_2 = new RpcMessage(RpcMessage.CALL);
   m_2.ifidx = 0;
   m_2.opidx = 0;
   m_2.paramsize = 1;
   m_2.extra.setProperties(props);
   try {
     ByteArrayOutputStream bos_3 = new ByteArrayOutputStream();
     DataOutputStream dos_4 = new DataOutputStream(bos_3);
     text.marshall(dos_4);
     m_2.paramstream = bos_3.toByteArray();
     m_2.prx = this;
   } catch (Exception e) {
     throw new RpcException(RpcConsts.RPCERROR_DATADIRTY, e.toString());
   }
   synchronized (m_2) {
     r_1 = this.conn.sendMessage(m_2);
     if (!r_1) {
       throw new RpcException(RpcConsts.RPCERROR_SENDFAILED);
     }
     try {
       if (timeout > 0) m_2.wait(timeout);
       else m_2.wait();
     } catch (Exception e) {
       throw new RpcException(RpcConsts.RPCERROR_INTERNAL_EXCEPTION, e.getMessage());
     }
   }
   if (m_2.errcode != RpcConsts.RPCERROR_SUCC) {
     throw new RpcException(m_2.errcode);
   }
   if (m_2.result == null) {
     throw new RpcException(RpcConsts.RPCERROR_TIMEOUT);
   }
 }