Beispiel #1
0
        public void timeout_async(int secs, Server_AsyncCallBack async, Dictionary <string, string> props, object cookie)
        {
            bool       r_5 = false;
            RpcMessage m_6 = new RpcMessage(RpcMessage.CALL | RpcMessage.ASYNC);

            m_6.ifidx     = 2;
            m_6.opidx     = 1;
            m_6.paramsize = 1;
            m_6.extra.setProperties(props);
            m_6.cookie = cookie;
            try{
                MemoryStream bos_7 = new MemoryStream();
                BinaryWriter dos_8 = new BinaryWriter(bos_7);
                RpcBinarySerializer.writeInt(secs, dos_8);
                m_6.paramstream = bos_7.ToArray();
                m_6.prx         = this;
                m_6.async       = async;
            }catch (Exception e) {
                throw new RpcException(RpcException.RPCERROR_DATADIRTY, e.ToString());
            }
            r_5 = this.conn.sendMessage(m_6);
            if (!r_5)
            {
                throw new RpcException(RpcException.RPCERROR_SENDFAILED);
            }
        }
Beispiel #2
0
        // timeout - msec ,  0 means waiting infinitely
        public void timeout(int secs, int timeout, Dictionary <string, string> props)
        {
            bool       r_1 = false;
            RpcMessage m_2 = new RpcMessage(RpcMessage.CALL);

            m_2.ifidx     = 2;
            m_2.opidx     = 1;
            m_2.paramsize = 1;
            m_2.extra.setProperties(props);
            try{
                MemoryStream bos_3 = new MemoryStream();
                BinaryWriter dos_4 = new BinaryWriter(bos_3);
                RpcBinarySerializer.writeInt(secs, dos_4);
                m_2.paramstream = bos_3.ToArray();
                m_2.prx         = this;
            }catch (Exception e) {
                RpcCommunicator.instance().logger.error(e.ToString());
                throw new RpcException(RpcException.RPCERROR_DATADIRTY, e.ToString());
            }
            r_1 = this.conn.sendMessage(m_2);
            if (!r_1)
            {
                throw new RpcException(RpcException.RPCERROR_SENDFAILED);
            }
            bool _rc_5 = false;

            try{
                if (timeout > 0)
                {
                    _rc_5 = m_2.ev.WaitOne(timeout);
                }
                else
                {
                    _rc_5 = m_2.ev.WaitOne(RpcCommunicator.instance().getProperty_DefaultCallWaitTime());
                }
            }catch (Exception e) {
                RpcCommunicator.instance().logger.error(e.ToString());
                throw new RpcException(RpcException.RPCERROR_INTERNAL_EXCEPTION, e.ToString());
            }
            if (_rc_5 == false)
            {
                throw new RpcException(RpcException.RPCERROR_TIMEOUT);
            }
            if (m_2.errcode != RpcException.RPCERROR_SUCC)
            {
                throw new RpcException(m_2.errcode);
            }
            if (m_2.result == null)
            {
                throw new RpcException(RpcException.RPCERROR_TIMEOUT, "response is null");
            }
        }
Beispiel #3
0
        public void timeout_oneway(int secs, Dictionary <string, string> props)
        {
            bool       r_1 = false;
            RpcMessage m_2 = new RpcMessage(RpcMessage.CALL | RpcMessage.ONEWAY);

            m_2.ifidx     = 2;
            m_2.opidx     = 1;
            m_2.paramsize = 1;
            m_2.extra.setProperties(props);
            try{
                MemoryStream bos_3 = new MemoryStream();
                BinaryWriter dos_4 = new BinaryWriter(bos_3);
                RpcBinarySerializer.writeInt(secs, dos_4);
                m_2.paramstream = bos_3.ToArray();
                m_2.prx         = this;
            }catch (Exception e) {
                throw new RpcException(RpcException.RPCERROR_DATADIRTY, e.ToString());
            }
            r_1 = this.conn.sendMessage(m_2);
            if (!r_1)
            {
                throw new RpcException(RpcException.RPCERROR_SENDFAILED);
            }
        }