| 
                         根据上面源码,我们发现主要是处理protocolHandler并初始化它,同时我们注意到了protocolHandler  设置了一个适配器,我们看看这个适配器是做啥的,跟踪源码如下: 
- /** 
 -  * The adapter, used to call the connector. 
 -  * 
 -  * @param adapter The adapter to associate 
 -  */ 
 -  public void setAdapter(Adapter adapter); 
 
  
这个注释已经说的很直白了,这个适配器就是用来调用连接器的。我们再继续看看protocolHandler的初始化方法 
-  /** 
 -  * Endpoint that provides low-level network I/O - must be matched to the 
 -  * ProtocolHandler implementation (ProtocolHandler using NIO, requires NIO 
 -  * Endpoint etc.). 
 -  */ 
 - private final AbstractEndpoint<S,?> endpoint; 
 - public void init() throws Exception { 
 -  if (getLog().isInfoEnabled()) { 
 -  getLog().info(sm.getString("abstractProtocolHandler.init", getName())); 
 -  logPortOffset(); 
 -  } 
 -  if (oname == null) { 
 -  // Component not pre-registered so register it 
 -  oname = createObjectName(); 
 -  if (oname != null) { 
 -  Registry.getRegistry(null, null).registerComponent(this, oname, null); 
 -  } 
 -  } 
 -  if (this.domain != null) { 
 -  rgOname = new ObjectName(domain + ":type=GlobalRequestProcessor,name=" + getName()); 
 -  Registry.getRegistry(null, null).registerComponent( 
 -  getHandler().getGlobal(), rgOname, null); 
 -  } 
 -  String endpointName = getName(); 
 -  endpoint.setName(endpointName.substring(1, endpointName.length()-1)); 
 -  endpoint.setDomain(domain); 
 -  endpoint.init(); 
 -  } 
 
  
                        (编辑:泰州站长网) 
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! 
                     |