}
public <T> Invoker<T> refer(final Class<T> serviceType, final URL url) throws RpcException {
if (! Remote.class.isAssignableFrom(serviceType)
&& "spring".equals(url.getParameter("codec", "spring"))) {
final RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
rmiProxyFactoryBean.setServiceUrl(url.toIdentityString());
rmiProxyFactoryBean.setServiceInterface(serviceType);
rmiProxyFactoryBean.setCacheStub(true);
rmiProxyFactoryBean.setLookupStubOnStartup(true);
rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
rmiProxyFactoryBean.afterPropertiesSet();
final Object remoteObject = rmiProxyFactoryBean.getObject();
return new Invoker<T>() {
public Class<T> getInterface() {
return serviceType;
}
public URL getUrl() {