You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2019/08/14 09:49:50 UTC
[dubbo-go] branch 1.1 updated: Add: version.go in common/constant
This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch 1.1
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/1.1 by this push:
new 33dc6ec Add: version.go in common/constant
33dc6ec is described below
commit 33dc6ec9dbdecaa51ed55647f04ee7f587394687
Author: AlexStocks <al...@foxmail.com>
AuthorDate: Wed Aug 14 17:49:39 2019 +0800
Add: version.go in common/constant
---
cluster/cluster_impl/base_cluster_invoker.go | 9 ++++-----
cluster/cluster_impl/failover_cluster_invoker.go | 5 ++---
common/constant/version.go | 24 ++++++++++++++++++++++++
config/config_loader.go | 3 +--
registry/zookeeper/registry.go | 7 +++----
5 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/cluster/cluster_impl/base_cluster_invoker.go b/cluster/cluster_impl/base_cluster_invoker.go
index d42a099..5bcadee 100644
--- a/cluster/cluster_impl/base_cluster_invoker.go
+++ b/cluster/cluster_impl/base_cluster_invoker.go
@@ -29,7 +29,6 @@ import (
"github.com/apache/dubbo-go/common/extension"
"github.com/apache/dubbo-go/common/utils"
"github.com/apache/dubbo-go/protocol"
- "github.com/apache/dubbo-go/version"
)
type baseClusterInvoker struct {
@@ -66,8 +65,8 @@ func (invoker *baseClusterInvoker) checkInvokers(invokers []protocol.Invoker, in
if len(invokers) == 0 {
ip, _ := utils.GetLocalIP()
return perrors.Errorf("Failed to invoke the method %v. No provider available for the service %v from "+
- "registry %v on the consumer %v using the dubbo version %v .Please check if the providers have been started and registered.",
- invocation.MethodName(), invoker.directory.GetUrl().SubURL.Key(), invoker.directory.GetUrl().String(), ip, version.Version)
+ "registry %v on the consumer %v using the dubbo constant %v .Please check if the providers have been started and registered.",
+ invocation.MethodName(), invoker.directory.GetUrl().SubURL.Key(), invoker.directory.GetUrl().String(), ip, constant.Version)
}
return nil
@@ -77,8 +76,8 @@ func (invoker *baseClusterInvoker) checkInvokers(invokers []protocol.Invoker, in
func (invoker *baseClusterInvoker) checkWhetherDestroyed() error {
if invoker.destroyed.Load() {
ip, _ := utils.GetLocalIP()
- return perrors.Errorf("Rpc cluster invoker for %v on consumer %v use dubbo version %v is now destroyed! can not invoke any more. ",
- invoker.directory.GetUrl().Service(), ip, version.Version)
+ return perrors.Errorf("Rpc cluster invoker for %v on consumer %v use dubbo constant %v is now destroyed! can not invoke any more. ",
+ invoker.directory.GetUrl().Service(), ip, constant.Version)
}
return nil
}
diff --git a/cluster/cluster_impl/failover_cluster_invoker.go b/cluster/cluster_impl/failover_cluster_invoker.go
index 6966426..2ab5fdc 100644
--- a/cluster/cluster_impl/failover_cluster_invoker.go
+++ b/cluster/cluster_impl/failover_cluster_invoker.go
@@ -26,7 +26,6 @@ import (
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/utils"
"github.com/apache/dubbo-go/protocol"
- "github.com/apache/dubbo-go/version"
)
type failoverClusterInvoker struct {
@@ -90,7 +89,7 @@ func (invoker *failoverClusterInvoker) Invoke(invocation protocol.Invocation) pr
}
ip, _ := utils.GetLocalIP()
return &protocol.RPCResult{Err: perrors.Errorf("Failed to invoke the method %v in the service %v. Tried %v times of "+
- "the providers %v (%v/%v)from the registry %v on the consumer %v using the dubbo version %v. Last error is %v.",
- methodName, invoker.GetUrl().Service(), retries, providers, len(providers), len(invokers), invoker.directory.GetUrl(), ip, version.Version, result.Error().Error(),
+ "the providers %v (%v/%v)from the registry %v on the consumer %v using the dubbo constant %v. Last error is %v.",
+ methodName, invoker.GetUrl().Service(), retries, providers, len(providers), len(invokers), invoker.directory.GetUrl(), ip, constant.Version, result.Error().Error(),
)}
}
diff --git a/common/constant/version.go b/common/constant/version.go
new file mode 100644
index 0000000..d4c6821
--- /dev/null
+++ b/common/constant/version.go
@@ -0,0 +1,24 @@
+/*
+ * 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 constant
+
+const (
+ Version = "2.6.0"
+ Name = "dubbogo"
+ DATE = "2019/05/06"
+)
diff --git a/config/config_loader.go b/config/config_loader.go
index 720f65f..cabf3d1 100644
--- a/config/config_loader.go
+++ b/config/config_loader.go
@@ -28,7 +28,6 @@ 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/version"
)
var (
@@ -94,7 +93,7 @@ func Load() {
checkok = false
count++
if count > maxWait {
- panic(fmt.Sprintf("Failed to check the status of the service %v . No provider available for the service to the consumer use dubbo version %v", refconfig.InterfaceName, version.Version))
+ panic(fmt.Sprintf("Failed to check the status of the service %v . No provider available for the service to the consumer use dubbo constant %v", refconfig.InterfaceName, constant.Version))
}
time.Sleep(time.Second * 1)
break
diff --git a/registry/zookeeper/registry.go b/registry/zookeeper/registry.go
index 003ee29..6fa38a7 100644
--- a/registry/zookeeper/registry.go
+++ b/registry/zookeeper/registry.go
@@ -41,7 +41,6 @@ import (
"github.com/apache/dubbo-go/common/utils"
"github.com/apache/dubbo-go/registry"
"github.com/apache/dubbo-go/remoting/zookeeper"
- "github.com/apache/dubbo-go/version"
)
const (
@@ -234,7 +233,7 @@ func (r *zkRegistry) Register(conf common.URL) error {
r.cltLock.Lock()
// Note the difference between consumer and consumerZookeeperRegistry (consumer use conf.Path).
// Because the consumer wants to provide monitoring functions for the selector,
- // the provider allows multiple groups or versions of the same service to be registered.
+ // the provider allows multiple groups or constants of the same service to be registered.
_, ok = r.services[conf.Key()]
r.cltLock.Unlock()
if ok {
@@ -304,7 +303,7 @@ func (r *zkRegistry) register(c common.URL) error {
// DubboRole = [...]string{"consumer", "", "", "provider"}
// params.Add("category", (RoleType(PROVIDER)).Role())
params.Add("category", (common.RoleType(common.PROVIDER)).String())
- params.Add("dubbo", "dubbo-provider-golang-"+version.Version)
+ params.Add("dubbo", "dubbo-provider-golang-"+constant.Version)
params.Add("side", (common.RoleType(common.PROVIDER)).Role())
@@ -347,7 +346,7 @@ func (r *zkRegistry) register(c common.URL) error {
params.Add("protocol", c.Protocol)
params.Add("category", (common.RoleType(common.CONSUMER)).String())
- params.Add("dubbo", "dubbogo-consumer-"+version.Version)
+ params.Add("dubbo", "dubbogo-consumer-"+constant.Version)
rawURL = fmt.Sprintf("consumer://%s%s?%s", localIP, c.Path, params.Encode())
encodedURL = url.QueryEscape(rawURL)