diff --git a/common/configuration_listener.go b/common/configuration_listener.go index 25f02da6f540c64862c8b333e85b9a445b4161c6..b322256e31e949dd7d3dc10d4275122272c4ac29 100644 --- a/common/configuration_listener.go +++ b/common/configuration_listener.go @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package common import "fmt" diff --git a/config_center/dynamic_configuration.go b/config_center/dynamic_configuration.go index 4f388a7dd89c121d0e8c1b83829ff5fa35fea24c..57b04f7440a74c72ab1df164cd4326713cf0fd19 100644 --- a/config_center/dynamic_configuration.go +++ b/config_center/dynamic_configuration.go @@ -18,9 +18,11 @@ package config_center import ( - "github.com/apache/dubbo-go/common" "time" ) +import ( + "github.com/apache/dubbo-go/common" +) ////////////////////////////////////////// // DynamicConfiguration diff --git a/config_center/zookeeper/dynamic_configuration.go b/config_center/zookeeper/dynamic_configuration.go index 7c5ca4487fcdcaa88d403bb5587b47470e7666cb..b94f18a69b5c1912cf59165a84c06eb9b99fcce2 100644 --- a/config_center/zookeeper/dynamic_configuration.go +++ b/config_center/zookeeper/dynamic_configuration.go @@ -17,13 +17,15 @@ package zookeeper +import ( + "sync" +) import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/config_center" "github.com/apache/dubbo-go/remoting/zookeeper" - "sync" ) const ZkClient = "zk config_center" diff --git a/registry/zookeeper/dataListener.go b/registry/zookeeper/listener.go similarity index 76% rename from registry/zookeeper/dataListener.go rename to registry/zookeeper/listener.go index 792db4c7cc409be833912a038664d00cc0ad42f7..f30f2e29d58b93df5f064cddf45827da1cfeeaf4 100644 --- a/registry/zookeeper/dataListener.go +++ b/registry/zookeeper/listener.go @@ -1,12 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package zookeeper import ( "context" +) +import ( + perrors "github.com/pkg/errors" +) +import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/registry" zk "github.com/apache/dubbo-go/remoting/zookeeper" - perrors "github.com/pkg/errors" ) type RegistryDataListener struct { diff --git a/registry/zookeeper/registry.go b/registry/zookeeper/registry.go index 01841867051c84d536f38f23833430a433938bdb..8f9e865d5e56905d7a26d3c3ccc645f68650b815 100644 --- a/registry/zookeeper/registry.go +++ b/registry/zookeeper/registry.go @@ -29,7 +29,6 @@ import ( ) import ( - "github.com/apache/dubbo-go/common/logger" perrors "github.com/pkg/errors" "github.com/samuel/go-zookeeper/zk" ) @@ -38,6 +37,7 @@ import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" + "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/common/utils" "github.com/apache/dubbo-go/registry" "github.com/apache/dubbo-go/remoting/zookeeper" diff --git a/registry/zookeeper/registry_test.go b/registry/zookeeper/registry_test.go index aac6b883d89cc52d71712a66c718eac7bb823f2c..ba2755fa9923d9e6c11a1908594a176ace458691 100644 --- a/registry/zookeeper/registry_test.go +++ b/registry/zookeeper/registry_test.go @@ -19,7 +19,6 @@ package zookeeper import ( "context" - "github.com/apache/dubbo-go/remoting/zookeeper" "strconv" "testing" "time" @@ -32,6 +31,7 @@ import ( import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" + "github.com/apache/dubbo-go/remoting/zookeeper" ) func Test_Register(t *testing.T) { diff --git a/remoting/zookeeper/client.go b/remoting/zookeeper/client.go index d431822ffbeb912c19dd1ae79e7792c06c80aef6..93382ed265ef2189cd0ad41bbe72adb8de606844 100644 --- a/remoting/zookeeper/client.go +++ b/remoting/zookeeper/client.go @@ -18,7 +18,6 @@ package zookeeper import ( - "github.com/apache/dubbo-go/common/constant" "path" "strings" "sync" @@ -26,11 +25,15 @@ import ( ) import ( - "github.com/apache/dubbo-go/common/logger" perrors "github.com/pkg/errors" "github.com/samuel/go-zookeeper/zk" ) +import ( + "github.com/apache/dubbo-go/common/constant" + "github.com/apache/dubbo-go/common/logger" +) + const ( ConnDelay = 3 MaxFailTimes = 15 @@ -220,7 +223,6 @@ func NewMockZookeeperClient(name string, timeout time.Duration, opts ...Option) return ts, z, event, nil } - func (z *ZookeeperClient) HandleZkEvent(session <-chan zk.Event) { var ( state int diff --git a/remoting/zookeeper/container.go b/remoting/zookeeper/container.go index fe262adb20e483f8044189857689ae3808e0e32a..f869b32444a58c3396ec5520b7b8f859f4accd6f 100644 --- a/remoting/zookeeper/container.go +++ b/remoting/zookeeper/container.go @@ -1,12 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package zookeeper import ( - "github.com/apache/dubbo-go/common" - "github.com/apache/dubbo-go/common/logger" - perrors "github.com/pkg/errors" "sync" "time" ) +import ( + perrors "github.com/pkg/errors" +) + +import ( + "github.com/apache/dubbo-go/common" + "github.com/apache/dubbo-go/common/logger" +) type ZkClientContainer interface { ZkClient() *ZookeeperClient diff --git a/remoting/zookeeper/dataListener.go b/remoting/zookeeper/dataListener.go deleted file mode 100644 index 4d3cb9efb5b81214bc4a3a6bf0ec862014e94627..0000000000000000000000000000000000000000 --- a/remoting/zookeeper/dataListener.go +++ /dev/null @@ -1,5 +0,0 @@ -package zookeeper - -type DataListener interface { - DataChange(eventType ZkEvent) bool //bool is return for interface implement is interesting -} diff --git a/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go index c7ac4593523604e9a84330d2a88d8bfb2c735b47..2fef2d8e0cf7ad5c5b0a0ed1ebfd7c10613cabc5 100644 --- a/remoting/zookeeper/listener.go +++ b/remoting/zookeeper/listener.go @@ -25,15 +25,19 @@ import ( ) import ( - "github.com/apache/dubbo-go/common/logger" perrors "github.com/pkg/errors" "github.com/samuel/go-zookeeper/zk" ) import ( "github.com/apache/dubbo-go/common" + "github.com/apache/dubbo-go/common/logger" ) +type DataListener interface { + DataChange(eventType ZkEvent) bool //bool is return for interface implement is interesting +} + type ZkEvent struct { Res *common.Event err error