diff --git a/cluster/cluster_impl/forking_cluster_invoker.go b/cluster/cluster_impl/forking_cluster_invoker.go index be3203070d37de296d116a1e6f6831fd7d58365b..3ffda580ce9847bb60a0a837c5fac6b420450141 100644 --- a/cluster/cluster_impl/forking_cluster_invoker.go +++ b/cluster/cluster_impl/forking_cluster_invoker.go @@ -56,7 +56,7 @@ func (invoker *forkingClusterInvoker) Invoke(ctx context.Context, invocation pro } var selected []protocol.Invoker - forks := invoker.GetUrl().GetParamByInt0(constant.FORKS_KEY, constant.DEFAULT_FORKS) + forks := invoker.GetUrl().GetParamByIntValue(constant.FORKS_KEY, constant.DEFAULT_FORKS) timeouts := invoker.GetUrl().GetParamInt(constant.TIMEOUT_KEY, constant.DEFAULT_TIMEOUT) if forks < 0 || forks > len(invokers) { selected = invokers diff --git a/cluster/loadbalance/consistent_hash.go b/cluster/loadbalance/consistent_hash.go index 3cb14d6287e9b7731b147cf5844fc60ec4459ee5..3d036b4f3c5c50874e09efb8fd1ef34e969585d8 100644 --- a/cluster/loadbalance/consistent_hash.go +++ b/cluster/loadbalance/consistent_hash.go @@ -105,7 +105,7 @@ func newConsistentHashSelector(invokers []protocol.Invoker, methodName string, selector.virtualInvokers = make(map[uint32]protocol.Invoker) selector.hashCode = hashCode url := invokers[0].GetUrl() - selector.replicaNum = url.GetMethodParamInt0(methodName, HashNodes, 160) + selector.replicaNum = url.GetMethodParamIntValue(methodName, HashNodes, 160) indices := re.Split(url.GetMethodParam(methodName, HashArguments, "0"), -1) for _, index := range indices { i, err := strconv.Atoi(index) diff --git a/common/url.go b/common/url.go index 665aeb5ee3fdb1d07f26ff9fa86bdd518f47c539..eae36ce6927d7c73225488391ef9b9fb0121a2d4 100644 --- a/common/url.go +++ b/common/url.go @@ -502,8 +502,8 @@ func (c URL) GetParamInt32(key string, d int32) int32 { return int32(r) } -// GetParamByInt0 gets int value by @key -func (c URL) GetParamByInt0(key string, d int) int { +// GetParamByIntValue gets int value by @key +func (c URL) GetParamByIntValue(key string, d int) int { r, err := strconv.ParseInt(c.GetParam(key, ""), 10, 0) if r == 0 || err != nil { return d @@ -520,8 +520,8 @@ func (c URL) GetMethodParamInt(method string, key string, d int64) int64 { return r } -// GetMethodParamInt0 gets int method param -func (c URL) GetMethodParamInt0(method string, key string, d int) int { +// GetMethodParamIntValue gets int method param +func (c URL) GetMethodParamIntValue(method string, key string, d int) int { r, err := strconv.ParseInt(c.GetParam("methods."+method+"."+key, ""), 10, 0) if r == 0 || err != nil { return d