Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static void preProcess(ResponseCommand responseCommand, String addr) throws exception.RemotingException
        private static void preProcess(ResponseCommand responseCommand, string addr)
        {
            RemotingException e   = null;
            string            msg = null;

            if (responseCommand == null)
            {
                msg = string.Format("Rpc invocation timeout[responseCommand null]! the address is {0}", addr);
                e   = new InvokeTimeoutException(msg);
            }
            else
            {
                switch (responseCommand.ResponseStatus)
                {
                case ResponseStatus.TIMEOUT:
                    msg = string.Format("Rpc invocation timeout[responseCommand TIMEOUT]! the address is {0}", addr);
                    e   = new InvokeTimeoutException(msg);
                    break;

                case ResponseStatus.CLIENT_SEND_ERROR:
                    msg = string.Format("Rpc invocation send failed! the address is {0}", addr);
                    e   = new InvokeSendFailedException(msg, responseCommand.Cause);
                    break;

                case ResponseStatus.CONNECTION_CLOSED:
                    msg = string.Format("Connection closed! the address is {0}", addr);
                    e   = new ConnectionClosedException(msg);
                    break;

                case ResponseStatus.SERVER_THREADPOOL_BUSY:
                    msg = string.Format("Server thread pool busy! the address is {0}, id={1}", addr, responseCommand.Id);
                    e   = new InvokeServerBusyException(msg);
                    break;

                case ResponseStatus.CODEC_EXCEPTION:
                    msg = string.Format("Codec exception! the address is {0}, id={1}", addr, responseCommand.Id);
                    e   = new CodecException(msg);
                    break;

                case ResponseStatus.SERVER_SERIAL_EXCEPTION:
                    msg = string.Format("Server serialize response exception! the address is {0}, id={1}, serverSide=true", addr, responseCommand.Id);
                    e   = new SerializationException(detailErrMsg(msg, responseCommand), toThrowable(responseCommand), true);
                    break;

                case ResponseStatus.SERVER_DESERIAL_EXCEPTION:
                    msg = string.Format("Server deserialize request exception! the address is {0}, id={1}, serverSide=true", addr, responseCommand.Id);
                    e   = new DeserializationException(detailErrMsg(msg, responseCommand), toThrowable(responseCommand), true);
                    break;

                case ResponseStatus.SERVER_EXCEPTION:
                    msg = string.Format("Server exception! Please check the server log, the address is {0}, id={1}", addr, responseCommand.Id);
                    e   = new InvokeServerException(detailErrMsg(msg, responseCommand), toThrowable(responseCommand));
                    break;

                default:
                    break;
                }
            }
            if (!string.IsNullOrWhiteSpace(msg))
            {
                logger.LogWarning(msg);
            }
            if (null != e)
            {
                throw e;
            }
        }
Exemplo n.º 2
0
 public override void OnError(MediaCodec codec, CodecException e)
 {
     Console.WriteLine(e);
 }