/// <summary>
        /// dispatch request command to user processor
        /// </summary>
        /// <param name="ctx"> remoting context </param>
        /// <param name="cmd"> rpc request command </param>
        private void dispatchToUserProcessor(RemotingContext ctx, RpcRequestCommand cmd)
        {
            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final int id = cmd.getId();
            int id = cmd.Id;
            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final byte type = cmd.getType();
            byte type = cmd.Type;
            // processor here must not be null, for it have been checked before
            UserProcessor processor = ctx.getUserProcessor(cmd.RequestClass);

            if (processor is AsyncUserProcessor)
            {
                try
                {
                    processor.handleRequest(processor.preHandleRequest(ctx, cmd.RequestObject), new RpcAsyncContext(ctx, cmd, this), cmd.RequestObject);
                }
                catch (RejectedExecutionException)
                {
                    logger.LogWarning("RejectedExecutionException occurred when do ASYNC process in RpcRequestProcessor");
                    sendResponseIfNecessary(ctx, type, CommandFactory.createExceptionResponse(id, ResponseStatus.SERVER_THREADPOOL_BUSY));
                }
                catch (System.Exception t)
                {
                    string errMsg = "AYSNC process rpc request failed in RpcRequestProcessor, id=" + id;
                    logger.LogError(errMsg, t);
                    sendResponseIfNecessary(ctx, type, CommandFactory.createExceptionResponse(id, t, errMsg));
                }
            }
            else
            {
                try
                {
                    object responseObject = processor.handleRequest(processor.preHandleRequest(ctx, cmd.RequestObject), cmd.RequestObject);

                    sendResponseIfNecessary(ctx, type, CommandFactory.createResponse(responseObject, cmd));
                }
                catch (RejectedExecutionException)
                {
                    logger.LogWarning("RejectedExecutionException occurred when do SYNC process in RpcRequestProcessor");
                    sendResponseIfNecessary(ctx, type, CommandFactory.createExceptionResponse(id, ResponseStatus.SERVER_THREADPOOL_BUSY));
                }
                catch (System.Exception t)
                {
                    string errMsg = "SYNC process rpc request failed in RpcRequestProcessor, id=" + id;
                    logger.LogError(errMsg, t);
                    sendResponseIfNecessary(ctx, type, CommandFactory.createExceptionResponse(id, t, errMsg));
                }
            }
        }
        /// <seealso cref= AbstractRemotingProcessor#process(RemotingContext, RemotingCommand, java.util.concurrent.ExecutorService) </seealso>
        public override void process(RemotingContext ctx, RemotingCommand cmd, ExecutorService defaultExecutor)
        {
            var rpcRequestCommand = (RpcRequestCommand)cmd;

            if (!deserializeRequestCommand(ctx, rpcRequestCommand, RpcDeserializeLevel.DESERIALIZE_CLAZZ))
            {
                return;
            }
            UserProcessor userProcessor = ctx.getUserProcessor(rpcRequestCommand.RequestClass);

            if (userProcessor == null)
            {
                string errMsg = "No user processor found for request: " + rpcRequestCommand.RequestClass;
                logger.LogError(errMsg);
                sendResponseIfNecessary(ctx, rpcRequestCommand.Type, CommandFactory.createExceptionResponse(cmd.Id, errMsg));
                return; // must end process
            }

            // set timeout check state from user's processor
            ctx.setTimeoutDiscard(userProcessor.timeoutDiscard());

            // to check whether to process in io thread
            if (userProcessor.processInIOThread())
            {
                if (!deserializeRequestCommand(ctx, rpcRequestCommand, RpcDeserializeLevel.DESERIALIZE_ALL))
                {
                    return;
                }
                // process in io thread
                new ProcessTask(this, ctx, rpcRequestCommand).run();
                return; // end
            }

            Executor executor;

            // to check whether get executor using executor selector
            if (null == userProcessor.ExecutorSelector)
            {
                executor = userProcessor.Executor;
            }
            else
            {
                // in case haven't deserialized in io thread
                // it need to deserialize clazz and header before using executor dispath strategy
                if (!deserializeRequestCommand(ctx, rpcRequestCommand, RpcDeserializeLevel.DESERIALIZE_HEADER))
                {
                    return;
                }
                //try get executor with strategy
                executor = userProcessor.ExecutorSelector.select(rpcRequestCommand.RequestClass, rpcRequestCommand.RequestHeader);
            }

            // Till now, if executor still null, then try default
            if (executor == null)
            {
                executor = Executor ?? defaultExecutor;
            }

            // use the final executor dispatch process task
            executor.execute(new ProcessTask(this, ctx, rpcRequestCommand));
        }