private void dispatchToUserProcessor(RemotingContext ctx, RpcRequestCommand cmd) {
        final int id = cmd.getId();
        final byte type = cmd.getType();
        // processor here must not be null, for it have been checked before
        UserProcessor processor = ctx.getUserProcessor(cmd.getRequestClass());

        ClassLoader classLoader = null;
        try {
            ClassLoader bizClassLoader = processor.getBizClassLoader();
            if (bizClassLoader != null) {
                classLoader = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(bizClassLoader);
            }

            if (processor instanceof AsyncUserProcessor
                || processor instanceof AsyncMultiInterestUserProcessor) {
                try {
                    processor.handleRequest(
                        processor.preHandleRequest(ctx, cmd.getRequestObject()),
                        new RpcAsyncContext(ctx, cmd, this), cmd.getRequestObject());
                } catch (RejectedExecutionException e) {
                    logger
                        .warn("RejectedExecutionException occurred when do ASYNC process in RpcRequestProcessor");
                    sendResponseIfNecessary(ctx, type, this.getCommandFactory()
                        .createExceptionResponse(id, ResponseStatus.SERVER_THREADPOOL_BUSY));
                } catch (Throwable t) {
                    String errMsg = "AYSNC process rpc request failed in RpcRequestProcessor, id="
                                    + id;
                    logger.error(errMsg, t);
                    sendResponseIfNecessary(ctx, type, this.getCommandFactory()
                        .createExceptionResponse(id, t, errMsg));
                }
            } else {
                try {
                    Object responseObject = processor.handleRequest(
                        processor.preHandleRequest(ctx, cmd.getRequestObject()),
                        cmd.getRequestObject());

                    sendResponseIfNecessary(ctx, type,
                        this.getCommandFactory().createResponse(responseObject, cmd));
                } catch (RejectedExecutionException e) {
                    logger
                        .warn("RejectedExecutionException occurred when do SYNC process in RpcRequestProcessor");
                    sendResponseIfNecessary(ctx, type, this.getCommandFactory()
                        .createExceptionResponse(id, ResponseStatus.SERVER_THREADPOOL_BUSY));
                } catch (Throwable t) {
                    String errMsg = "SYNC process rpc request failed in RpcRequestProcessor, id="
                                    + id;
                    logger.error(errMsg, t);
                    sendResponseIfNecessary(ctx, type, this.getCommandFactory()
                        .createExceptionResponse(id, t, errMsg));
                }
            }
        } finally {
            if (classLoader != null) {
                Thread.currentThread().setContextClassLoader(classLoader);
            }
        }
    }
dispatch request command to user processor
@param ctx remoting context
@param cmd rpc request command
src/main/java/com/alipay/remoting/rpc/protocol/RpcRequestProcessor.java