diff --git a/protocol/protocolwrapper/protocol_filter_wrapper.go b/protocol/protocolwrapper/protocol_filter_wrapper.go index 5b8f9499b8052c990f422f7edef4529d7c3b5314..79d2cf7f55ee81db39ea28448fc66a8a7494d8d1 100644 --- a/protocol/protocolwrapper/protocol_filter_wrapper.go +++ b/protocol/protocolwrapper/protocol_filter_wrapper.go @@ -68,10 +68,6 @@ func (pfw *ProtocolFilterWrapper) Destroy() { } func buildInvokerChain(invoker protocol.Invoker, key string) protocol.Invoker { - if invoker == nil { - return invoker - } - filterName := invoker.GetUrl().GetParam(key, "") if filterName == "" { return invoker diff --git a/remoting/zookeeper/client.go b/remoting/zookeeper/client.go index 26d8083172e8cf28d545b1b7016f84fe303da53c..fbd90762eb34f361a38486ef2d8f5f10699a96f7 100644 --- a/remoting/zookeeper/client.go +++ b/remoting/zookeeper/client.go @@ -38,7 +38,7 @@ const ( // ConnDelay connection delay interval ConnDelay = 3 // MaxFailTimes max fail times - MaxFailTimes = 3 + MaxFailTimes = 15 ) var ( @@ -259,6 +259,7 @@ func (z *ZookeeperClient) HandleZkEvent(session <-chan zk.Event) { switch (int)(event.State) { case (int)(zk.StateDisconnected): logger.Warnf("zk{addr:%s} state is StateDisconnected, so close the zk client{name:%s}.", z.ZkAddrs, z.name) + z.stop() z.Lock() conn := z.Conn z.Conn = nil @@ -266,7 +267,6 @@ func (z *ZookeeperClient) HandleZkEvent(session <-chan zk.Event) { if conn != nil { conn.Close() } - z.stop() return case (int)(zk.EventNodeDataChanged), (int)(zk.EventNodeChildrenChanged): logger.Infof("zkClient{%s} get zk node changed event{path:%s}", z.name, event.Path) diff --git a/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go index f70ce577e3c3252e6352cd019dcf59c5d532bf8f..e5ddcadeaca9c3ce972cbe781413ebec7393afce 100644 --- a/remoting/zookeeper/listener.go +++ b/remoting/zookeeper/listener.go @@ -134,7 +134,7 @@ func (l *ZkEventListener) handleZkNodeEvent(zkPath string, children []string, li newChildren, err := l.client.GetChildren(zkPath) if err != nil { - /*if err == errNilChildren { + if err == errNilChildren { content, _, err := l.client.Conn.Get(zkPath) if err != nil { logger.Errorf("Get new node path {%v} 's content error,message is {%v}", zkPath, perrors.WithStack(err)) @@ -144,9 +144,7 @@ func (l *ZkEventListener) handleZkNodeEvent(zkPath string, children []string, li } else { logger.Errorf("path{%s} child nodes changed, zk.Children() = error{%v}", zkPath, perrors.WithStack(err)) - }*/ - logger.Errorf("path{%s} child nodes are empty, zk.Children() = error{%v}", zkPath, perrors.WithStack(err)) - return + } } // a node was added -- listen the new node @@ -253,7 +251,7 @@ func (l *ZkEventListener) listenDirEvent(conf *common.URL, zkPath string, listen case <-event: logger.Infof("get zk.EventNodeDataChange notify event") l.client.UnregisterEvent(zkPath, &event) - l.handleZkNodeEvent(zkPath, children, listener) + l.handleZkNodeEvent(zkPath, nil, listener) continue } }