@Test public void buildProxy() throws Exception { TestProxyInterface testInterface = ProxyFactory.buildProxy("test", TestProxyInterface.class, null); Assert.assertEquals(testInterface, null); boolean error = false; try { ProxyFactory.buildProxy("xasdasd", TestProxyInterface.class, null); } catch (Exception e) { error = true; } Assert.assertTrue(error); }
public static <T> T buildProxy(String proxyType, Class<T> clazz, Invoker proxyInvoker) throws Exception { try { ExtensionClass<Proxy> ext = ExtensionLoaderFactory.getExtensionLoader(Proxy.class) .getExtensionClass(proxyType); if (ext == null) { throw new SofaRpcRuntimeException(LogCodes.getLog(LogCodes.ERROR_LOAD_EXT, "Proxy", proxyType)); } Proxy proxy = ext.getExtInstance(); return proxy.getProxy(clazz, proxyInvoker); } catch (SofaRpcRuntimeException e) { throw e; } catch (Throwable e) { throw new SofaRpcRuntimeException(LogCodes.getLog(LogCodes.ERROR_LOAD_EXT, "Proxy", proxyType), e); } }
ProxyFactory { public static <T> T buildProxy(String proxyType, Class<T> clazz, Invoker proxyInvoker) throws Exception { try { ExtensionClass<Proxy> ext = ExtensionLoaderFactory.getExtensionLoader(Proxy.class) .getExtensionClass(proxyType); if (ext == null) { throw new SofaRpcRuntimeException(LogCodes.getLog(LogCodes.ERROR_LOAD_EXT, "Proxy", proxyType)); } Proxy proxy = ext.getExtInstance(); return proxy.getProxy(clazz, proxyInvoker); } catch (SofaRpcRuntimeException e) { throw e; } catch (Throwable e) { throw new SofaRpcRuntimeException(LogCodes.getLog(LogCodes.ERROR_LOAD_EXT, "Proxy", proxyType), e); } } }
ProxyFactory { public static <T> T buildProxy(String proxyType, Class<T> clazz, Invoker proxyInvoker) throws Exception { try { ExtensionClass<Proxy> ext = ExtensionLoaderFactory.getExtensionLoader(Proxy.class) .getExtensionClass(proxyType); if (ext == null) { throw new SofaRpcRuntimeException(LogCodes.getLog(LogCodes.ERROR_LOAD_EXT, "Proxy", proxyType)); } Proxy proxy = ext.getExtInstance(); return proxy.getProxy(clazz, proxyInvoker); } catch (SofaRpcRuntimeException e) { throw e; } catch (Throwable e) { throw new SofaRpcRuntimeException(LogCodes.getLog(LogCodes.ERROR_LOAD_EXT, "Proxy", proxyType), e); } }  }
ProxyFactory { public static <T> T buildProxy(String proxyType, Class<T> clazz, Invoker proxyInvoker) throws Exception { try { ExtensionClass<Proxy> ext = ExtensionLoaderFactory.getExtensionLoader(Proxy.class) .getExtensionClass(proxyType); if (ext == null) { throw new SofaRpcRuntimeException(LogCodes.getLog(LogCodes.ERROR_LOAD_EXT, "Proxy", proxyType)); } Proxy proxy = ext.getExtInstance(); return proxy.getProxy(clazz, proxyInvoker); } catch (SofaRpcRuntimeException e) { throw e; } catch (Throwable e) { throw new SofaRpcRuntimeException(LogCodes.getLog(LogCodes.ERROR_LOAD_EXT, "Proxy", proxyType), e); } }  static T buildProxy(String proxyType, Class<T> clazz, Invoker proxyInvoker); static Invoker getInvoker(Object proxyObject, String proxyType); }
ProxyFactory { public static <T> T buildProxy(String proxyType, Class<T> clazz, Invoker proxyInvoker) throws Exception { try { ExtensionClass<Proxy> ext = ExtensionLoaderFactory.getExtensionLoader(Proxy.class) .getExtensionClass(proxyType); if (ext == null) { throw new SofaRpcRuntimeException(LogCodes.getLog(LogCodes.ERROR_LOAD_EXT, "Proxy", proxyType)); } Proxy proxy = ext.getExtInstance(); return proxy.getProxy(clazz, proxyInvoker); } catch (SofaRpcRuntimeException e) { throw e; } catch (Throwable e) { throw new SofaRpcRuntimeException(LogCodes.getLog(LogCodes.ERROR_LOAD_EXT, "Proxy", proxyType), e); } }  static T buildProxy(String proxyType, Class<T> clazz, Invoker proxyInvoker); static Invoker getInvoker(Object proxyObject, String proxyType);  }