Skip to content
Permalink
Browse files

Merge pull request #164 from amudong/master

Mod: translate Chinese comments to English
  • Loading branch information...
AlexStocks committed Aug 13, 2019
2 parents 2d24b6b + 003f80d commit 3ad9a8d9210390b3fd4216a72b8f5650ef1c7ab3
Showing with 44 additions and 42 deletions.
  1. +1 −1 cluster/cluster_impl/base_cluster_invoker.go
  2. +1 −1 config_center/zookeeper/impl.go
  3. +2 −2 examples/configcenter/zookeeper/dubbo/with-configcenter-go-client/app/client.go
  4. +1 −1 examples/configcenter/zookeeper/dubbo/with-configcenter-go-client/app/user.go
  5. +1 −1 examples/configcenter/zookeeper/dubbo/with-configcenter-go-server/app/server.go
  6. +1 −1 examples/configcenter/zookeeper/dubbo/with-configcenter-go-server/app/user.go
  7. +1 −1 examples/configcenter/zookeeper/jsonrpc/with-configcenter-go-client/app/client.go
  8. +1 −1 examples/configcenter/zookeeper/jsonrpc/with-configcenter-go-server/app/server.go
  9. +1 −1 examples/general/dubbo/go-client/app/client.go
  10. +1 −1 examples/general/dubbo/go-client/app/user.go
  11. +1 −1 examples/general/dubbo/go-server/app/server.go
  12. +2 −2 examples/general/dubbo/go-server/app/user.go
  13. +3 −3 examples/general/dubbo/java-client/src/main/java/com/ikurento/user/Consumer.java
  14. +2 −2 examples/general/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderAnotherImpl.java
  15. +2 −2 examples/general/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
  16. +1 −1 examples/general/jsonrpc/go-client/app/client.go
  17. +1 −1 examples/general/jsonrpc/go-server/app/server.go
  18. +3 −3 examples/general/jsonrpc/java-client/src/main/java/com/ikurento/user/Consumer.java
  19. +2 −2 examples/general/jsonrpc/java-server/src/main/java/com/ikurento/user/UserProviderAnotherImpl.java
  20. +2 −2 examples/general/jsonrpc/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
  21. +1 −1 examples/helloworld/dubbo/go-server/app/server.go
  22. +1 −1 examples/helloworld/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
  23. +1 −1 registry/zookeeper/listener.go
  24. +9 −7 registry/zookeeper/registry.go
  25. +2 −2 remoting/zookeeper/facade.go
@@ -84,7 +84,7 @@ func (invoker *baseClusterInvoker) checkWhetherDestroyed() error {
}

func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker {
//todo:ticky connect 粘纸连接
//todo:sticky connect
if len(invokers) == 1 {
return invokers[0]
}
@@ -196,7 +196,7 @@ func (r *zookeeperDynamicConfiguration) closeConfigs() {
r.cltLock.Lock()
defer r.cltLock.Unlock()
logger.Infof("begin to close provider zk client")
// 先关闭旧client,以关闭tmp node
// Close the old client first to close the tmp node
r.client.Close()
r.client = nil
}
@@ -27,7 +27,7 @@ import (
)

import (
"github.com/apache/dubbo-go-hessian2"
hessian "github.com/apache/dubbo-go-hessian2"
)

import (
@@ -140,7 +140,7 @@ func initSignal() {
os.Exit(1)
})

// 要么fastFailTimeout时间内执行完毕下面的逻辑然后程序退出,要么执行上面的超时函数程序强行退出
// The program exits normally or timeout forcibly exits.
fmt.Println("app exit now...")
return
}
@@ -83,7 +83,7 @@ type User struct {
Name string
Age int32
Time time.Time
Sex Gender // 注意此处,java enum Object <--> go string
Sex Gender // notice: java enum Object <--> go string
}

func (u User) String() string {
@@ -78,7 +78,7 @@ func initSignal() {
os.Exit(1)
})

// 要么fastFailTimeout时间内执行完毕下面的逻辑然后程序退出,要么执行上面的超时函数程序强行退出
// The program exits normally or timeout forcibly exits.
fmt.Println("provider app exit now...")
return
}
@@ -84,7 +84,7 @@ type (
Name string
Age int32
Time time.Time
Sex Gender // 注意此处,java enum Object <--> go string
Sex Gender // notice: java enum Object <--> go string
}

UserProvider struct {
@@ -125,7 +125,7 @@ func initSignal() {
os.Exit(1)
})

// 要么fastFailTimeout时间内执行完毕下面的逻辑然后程序退出,要么执行上面的超时函数程序强行退出
// The program exits normally or timeout forcibly exits.
fmt.Println("app exit now...")
return
}
@@ -67,7 +67,7 @@ func initSignal() {
os.Exit(1)
})

// 要么fastFailTimeout时间内执行完毕下面的逻辑然后程序退出,要么执行上面的超时函数程序强行退出
// The program exits normally or timeout forcibly exits.
fmt.Println("provider app exit now...")
return
}
@@ -83,7 +83,7 @@ func initSignal() {
os.Exit(1)
})

// 要么fastFailTimeout时间内执行完毕下面的逻辑然后程序退出,要么执行上面的超时函数程序强行退出
// The program exits normally or timeout forcibly exits.
fmt.Println("app exit now...")
return
}
@@ -89,7 +89,7 @@ type User struct {
Name string
Age int32
Time time.Time
Sex Gender // 注意此处,java enum Object <--> go string
Sex Gender // notice: java enum Object <--> go string
}

func (u User) String() string {
@@ -79,7 +79,7 @@ func initSignal() {
os.Exit(1)
})

// 要么fastFailTimeout时间内执行完毕下面的逻辑然后程序退出,要么执行上面的超时函数程序强行退出
// The program exits normally or timeout forcibly exits.
fmt.Println("provider app exit now...")
return
}
@@ -24,7 +24,7 @@ import (
)

import (
"github.com/apache/dubbo-go-hessian2"
hessian "github.com/apache/dubbo-go-hessian2"
)

type Gender hessian.JavaEnum
@@ -73,7 +73,7 @@ type (
Name string
Age int32
Time time.Time
Sex Gender // 注意此处,java enum Object <--> go string
Sex Gender // notice: java enum Object <--> go string
}
)

@@ -17,12 +17,12 @@
import java.util.List;

public class Consumer {
//定义一个私有变量 (Spring中要求)
// Define a private variable (Required in Spring)
private UserProvider userProvider;
private UserProvider userProvider1;
private UserProvider userProvider2;

//Spring注入(Spring中要求)
// Spring DI (Required in Spring)
public void setUserProvider(UserProvider u) {
this.userProvider = u;
}
@@ -33,7 +33,7 @@ public void setUserProvider2(UserProvider u) {
this.userProvider2 = u;
}

//启动consumer的入口函数(在配置文件中指定)
// Start the entry function for consumer (Specified in the configuration file)
public void start() throws Exception {
System.out.println("\n\ntest");
testGetUser();
@@ -9,8 +9,8 @@
import java.util.*;

public class UserProviderAnotherImpl implements UserProvider {
// private static final Logger logger = LoggerFactory.getLogger(getClass()); // 只输出到dubbo的log(logs/server.log)
private static final Logger logger = LoggerFactory.getLogger("userLogger"); // 输出到user-server.log
// private static final Logger logger = LoggerFactory.getLogger(getClass()); // Only output to dubbo's log(logs/server.log)
private static final Logger logger = LoggerFactory.getLogger("userLogger"); // Output to user-server.log

private Map<String, User> userMap = new HashMap<String, User>();

@@ -14,8 +14,8 @@
import org.slf4j.LoggerFactory;

public class UserProviderImpl implements UserProvider {
// private static final Logger logger = LoggerFactory.getLogger(getClass()); // 只输出到dubbo的log(logs/server.log)
private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); // 输出到user-server.log
// private static final Logger logger = LoggerFactory.getLogger(getClass()); // Only output to dubbo's log(logs/server.log)
private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); // Output to user-server.log
Map<String, User> userMap = new HashMap<String, User>();

public UserProviderImpl() {
@@ -78,7 +78,7 @@ func initSignal() {
os.Exit(1)
})

// 要么fastFailTimeout时间内执行完毕下面的逻辑然后程序退出,要么执行上面的超时函数程序强行退出
// The program exits normally or timeout forcibly exits.
fmt.Println("app exit now...")
return
}
@@ -69,7 +69,7 @@ func initSignal() {
os.Exit(1)
})

// 要么fastFailTimeout时间内执行完毕下面的逻辑然后程序退出,要么执行上面的超时函数程序强行退出
// The program exits normally or timeout forcibly exits.
fmt.Println("provider app exit now...")
return
}
@@ -17,12 +17,12 @@
import java.util.List;

public class Consumer {
//定义一个私有变量 (Spring中要求)
// Define a private variable (Required in Spring)
private UserProvider userProvider;
private UserProvider userProvider1;
private UserProvider userProvider2;

//Spring注入(Spring中要求)
// Spring DI (Required in Spring)
public void setUserProvider(UserProvider u) {
this.userProvider = u;
}
@@ -33,7 +33,7 @@ public void setUserProvider2(UserProvider u) {
this.userProvider2 = u;
}

//启动consumer的入口函数(在配置文件中指定)
// Start the entry function for consumer (Specified in the configuration file)
public void start() throws Exception {
System.out.println("\n\ntest");
testGetUser();
@@ -9,8 +9,8 @@
import java.util.*;

public class UserProviderAnotherImpl implements UserProvider {
// private static final Logger logger = LoggerFactory.getLogger(getClass()); // 只输出到dubbo的log(logs/server.log)
private static final Logger logger = LoggerFactory.getLogger("userLogger"); // 输出到user-server.log
// private static final Logger logger = LoggerFactory.getLogger(getClass()); // Only output to dubbo's log(logs/server.log)
private static final Logger logger = LoggerFactory.getLogger("userLogger"); // Output to user-server.log

private Map<String, User> userMap = new HashMap<String, User>();

@@ -14,8 +14,8 @@
import org.slf4j.LoggerFactory;

public class UserProviderImpl implements UserProvider {
// private static final Logger logger = LoggerFactory.getLogger(getClass()); // 只输出到dubbo的log(logs/server.log)
private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); // 输出到user-server.log
// private static final Logger logger = LoggerFactory.getLogger(getClass()); // Only output to dubbo's log(logs/server.log)
private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); // Output to user-server.log
Map<String, User> userMap = new HashMap<String, User>();

public UserProviderImpl() {
@@ -69,7 +69,7 @@ func initSignal() {
os.Exit(1)
})

// 要么fastFailTimeout时间内执行完毕下面的逻辑然后程序退出,要么执行上面的超时函数程序强行退出
// The program exits normally or timeout forcibly exits.
fmt.Println("provider app exit now...")
return
}
@@ -6,7 +6,7 @@
import org.slf4j.LoggerFactory;

public class UserProviderImpl implements UserProvider {
private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); // 输出到user-server.log
private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); //Output to user-server.log

public User GetUser(String userId) {
return new User(userId, "zhangsan", 18);
@@ -45,7 +45,7 @@ func (l *RegistryDataListener) AddInterestedURL(url *common.URL) {
}

func (l *RegistryDataListener) DataChange(eventType remoting.Event) bool {
//截取最后一位
// Intercept the last bit
url := eventType.Path[strings.Index(eventType.Path, "/providers/")+len("/providers/"):]
serviceURL, err := common.NewURL(context.TODO(), url)
if err != nil {
@@ -230,10 +230,11 @@ func (r *zkRegistry) Register(conf common.URL) error {

case common.PROVIDER:

// 检验服务是否已经注册过
// Check if the service has been registered
r.cltLock.Lock()
// 注意此处与consumerZookeeperRegistry的差异,consumer用的是conf.Path,
// 因为consumer要提供watch功能给selector使用, provider允许注册同一个service的多个group or version
// 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.
_, ok = r.services[conf.Key()]
r.cltLock.Unlock()
if ok {
@@ -298,7 +299,8 @@ func (r *zkRegistry) register(c common.URL) error {
}
params.Add("anyhost", "true")

// dubbo java consumer来启动找provider url时,因为category不匹配,会找不到provider,导致consumer启动不了,所以使用consumers&providers
// Dubbo java consumer to start looking for the provider url,because the category does not match,
// the provider will not find, causing the consumer can not start, so we use consumers.
// DubboRole = [...]string{"consumer", "", "", "provider"}
// params.Add("category", (RoleType(PROVIDER)).Role())
params.Add("category", (common.RoleType(common.PROVIDER)).String())
@@ -320,7 +322,7 @@ func (r *zkRegistry) register(c common.URL) error {
rawURL = fmt.Sprintf("%s://%s%s?%s", c.Protocol, host, c.Path, params.Encode())
encodedURL = url.QueryEscape(rawURL)

// 把自己注册service providers
// Print your own registration service providers.
dubboPath = fmt.Sprintf("/dubbo/%s/%s", c.Service(), (common.RoleType(common.PROVIDER)).String())
logger.Debugf("provider path:%s, url:%s", dubboPath, rawURL)

@@ -416,7 +418,7 @@ func (r *zkRegistry) getListener(conf common.URL) (*RegistryConfigurationListene
r.listenerLock.Unlock()
}

//注册到dataconfig的interested
//Interested register to dataconfig.
r.dataListener.AddInterestedURL(&conf)

go r.listener.ListenServiceEvent(fmt.Sprintf("/dubbo/%s/providers", conf.Service()), r.dataListener)
@@ -428,7 +430,7 @@ func (r *zkRegistry) closeRegisters() {
r.cltLock.Lock()
defer r.cltLock.Unlock()
logger.Infof("begin to close provider zk client")
// 先关闭旧client,以关闭tmp node
// Close the old client first to close the tmp node.
r.client.Close()
r.client = nil
r.services = nil
@@ -63,14 +63,14 @@ LOOP:
r.SetZkClient(nil)
r.ZkClientLock().Unlock()

// 接zk,直至成功
// Connect zk until success.
failTimes = 0
for {
select {
case <-r.GetDone():
logger.Warnf("(ZkProviderRegistry)reconnectZkRegistry goroutine exit now...")
break LOOP
case <-getty.GetTimeWheel().After(timeSecondDuration(failTimes * ConnDelay)): // 防止疯狂重连zk
case <-getty.GetTimeWheel().After(timeSecondDuration(failTimes * ConnDelay)): // Prevent crazy reconnection zk.
}
err = ValidateZookeeperClient(r, WithZkName(zkName))
logger.Infof("ZkProviderRegistry.validateZookeeperClient(zkAddr{%s}) = error{%#v}",

0 comments on commit 3ad9a8d

Please sign in to comment.
You can’t perform that action at this time.