- [ ] I have searched the 
[issues](https://github.com/apache/incubator-dubbo/issues) of this repository 
and believe that this is not a duplicate.
- [ ] I have checked the 
[FAQ](https://github.com/apache/incubator-dubbo/blob/master/FAQ.md) of this 
repository and believe that this is not a duplicate.

### Environment

Dubbo version: 2.6.2
Operating System version: win7
Java version: 1.8

### Step to reproduce this issue

阅读源码发现,每个代理实现类都会去判断默认实现

public class Protocol$Adaptive implements org.apache.dubbo.rpc.Protocol
{
    public void destroy()
    {
        throw new UnsupportedOperationException(
                "method public abstract void 
org.apache.dubbo.rpc.Protocol.destroy() of interface 
org.apache.dubbo.rpc.Protocol is not adaptive method!");
    }

    public int getDefaultPort()
    {
        throw new UnsupportedOperationException(
                "method public abstract int 
org.apache.dubbo.rpc.Protocol.getDefaultPort() of interface 
org.apache.dubbo.rpc.Protocol is not adaptive method!");
    }

    public org.apache.dubbo.rpc.Invoker refer(java.lang.Class arg0, 
org.apache.dubbo.common.URL arg1)
        throws org.apache.dubbo.rpc.RpcException
    {
        if (arg1 == null)
            throw new IllegalArgumentException("url == null");
        org.apache.dubbo.common.URL url = arg1;
        String extName = (url.getProtocol() == null ? "dubbo" : 
url.getProtocol());
        if (extName == null)
            throw new IllegalStateException("Fail to get 
extension(org.apache.dubbo.rpc.Protocol) name from url("
                    + url.toString() + ") use keys([protocol])");
        org.apache.dubbo.rpc.Protocol extension = 
(org.apache.dubbo.rpc.Protocol) ExtensionLoader
                
.getExtensionLoader(org.apache.dubbo.rpc.Protocol.class).getExtension(extName);
        return extension.refer(arg0, arg1);
    }

    public org.apache.dubbo.rpc.Exporter export(org.apache.dubbo.rpc.Invoker 
arg0)
        throws org.apache.dubbo.rpc.RpcException
    {
        if (arg0 == null)
            throw new IllegalArgumentException("org.apache.dubbo.rpc.Invoker 
argument == null");
        if (arg0.getUrl() == null)
            throw new IllegalArgumentException("org.apache.dubbo.rpc.Invoker 
argument getUrl() == null");
        org.apache.dubbo.common.URL url = arg0.getUrl();
        String extName = (url.getProtocol() == null ? "dubbo" : 
url.getProtocol());
        if (extName == null)
            throw new IllegalStateException("Fail to get 
extension(org.apache.dubbo.rpc.Protocol) name from url("
                    + url.toString() + ") use keys([protocol])");
        org.apache.dubbo.rpc.Protocol extension = 
(org.apache.dubbo.rpc.Protocol) ExtensionLoader
                
.getExtensionLoader(org.apache.dubbo.rpc.Protocol.class).getExtension(extName);
        return extension.export(arg0);
    }
}




[ Full content available at: 
https://github.com/apache/incubator-dubbo/issues/2398 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to