class DynamicJvmServiceInvoker extends ServiceProxy {

    private static final Logger   LOGGER          = SofaBootLoggerFactory
                                                      .getLogger(DynamicJvmServiceInvoker.class);

    private final Contract        contract;
    private final Object          targetService;
    private final String          bizIdentity;
    private final ClassLoader     clientClassloader;
    private final boolean         serialize;

    static protected final String TOSTRING_METHOD = "toString";
    static protected final String EQUALS_METHOD   = "equals";
    static protected final String HASHCODE_METHOD = "hashCode";

    public DynamicJvmServiceInvoker(ClassLoader clientClassloader, ClassLoader serviceClassLoader,
                                    Object targetService, Contract contract, String bizIdentity,
                                    boolean serialize) {
        super(serviceClassLoader);
        this.clientClassloader = clientClassloader;
        this.targetService = targetService;
        this.contract = contract;
        this.bizIdentity = bizIdentity;
        this.serialize = serialize;
    }

    @Override
    protected Object doInvoke(MethodInvocation invocation) throws Throwable {
        try {

            LOGGER.atDebug().log(() -> ">> Start in Cross App JVM service invoke, the service interface is  - "
                    + getInterfaceType());

            if (DynamicJvmServiceProxyFinder.getInstance().getBizManagerService() != null) {
                ReplayContext.setPlaceHolder();
            }

            Method targetMethod = invocation.getMethod();
            Object[] targetArguments = invocation.getArguments();

            if (TOSTRING_METHOD.equalsIgnoreCase(targetMethod.getName())
                && targetMethod.getParameterTypes().length == 0) {
                return targetService.toString();
            } else if (EQUALS_METHOD.equalsIgnoreCase(targetMethod.getName())
                       && targetMethod.getParameterTypes().length == 1) {
                return targetService.equals(targetArguments[0]);
            } else if (HASHCODE_METHOD.equalsIgnoreCase(targetMethod.getName())
                       && targetMethod.getParameterTypes().length == 0) {
                return targetService.hashCode();
            }

            Class[] oldArgumentTypes = targetMethod.getParameterTypes();
            Method transformMethod;
            // check whether skip serialize or not
            if (!serialize) {
                ClassLoader tcl = Thread.currentThread().getContextClassLoader();
                try {
                    pushThreadContextClassLoader(getServiceClassLoader());
                    transformMethod = getTargetMethod(targetMethod, oldArgumentTypes);
                    return transformMethod.invoke(targetService, targetArguments);
                } finally {
                    pushThreadContextClassLoader(tcl);
                }
            } else {
                Object[] arguments = (Object[]) hessianTransport(targetArguments, null);
                Class<?>[] argumentTypes = (Class<?>[]) hessianTransport(oldArgumentTypes, null);
                transformMethod = getTargetMethod(targetMethod, argumentTypes);
                Object retVal = transformMethod.invoke(targetService, arguments);
                return hessianTransport(retVal, clientClassloader);
            }
        } catch (InvocationTargetException ex) {
            throw ex.getTargetException();
        } finally {
            if (DynamicJvmServiceProxyFinder.getInstance().getBizManagerService() != null) {
                ReplayContext.clearPlaceHolder();
            }
        }
    }

    @Override
    protected void doCatch(MethodInvocation invocation, Throwable e, long startTime) {
        LOGGER.atDebug().log(() -> getCommonInvocationLog("Exception", invocation, startTime));
    }

    @Override
    protected void doFinally(MethodInvocation invocation, long startTime) {
        LOGGER.atDebug().log(() -> getCommonInvocationLog("Finally", invocation, startTime));
    }

    public boolean isSerialize() {
        return serialize;
    }

    public Class<?> getInterfaceType() {
        return contract.getInterfaceType();
    }

    private Method getTargetMethod(Method method, Class<?>[] argumentTypes) {
        try {
            return targetService.getClass().getMethod(method.getName(), argumentTypes);
        } catch (NoSuchMethodException ex) {
            throw new IllegalStateException(targetService + " in " + bizIdentity
                                            + " don't have the method " + method);
        }
    }

    private static Object hessianTransport(Object source, ClassLoader contextClassLoader) {<FILL_FUNCTION_BODY>}
}

        Object target;
        ClassLoader currentContextClassloader = Thread.currentThread().getContextClassLoader();
        try {
            if (contextClassLoader != null) {
                Thread.currentThread().setContextClassLoader(contextClassLoader);
            }
            SerializerFactory serializerFactory = new SerializerFactory();
            serializerFactory.setAllowNonSerializable(true);
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            Hessian2Output h2o = new Hessian2Output(bos);
            h2o.setSerializerFactory(serializerFactory);
            h2o.writeObject(source);
            h2o.flush();
            byte[] content = bos.toByteArray();

            Hessian2Input h2i = new Hessian2Input(new ByteArrayInputStream(content));
            h2i.setSerializerFactory(serializerFactory);
            target = h2i.readObject();
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        } finally {
            Thread.currentThread().setContextClassLoader(currentContextClassloader);
        }
        return target;
    
<methods>public void <init>(java.lang.ClassLoader) ,public java.lang.ClassLoader getServiceClassLoader() ,public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation) throws java.lang.Throwable<variables>protected java.lang.ClassLoader serviceClassLoader