Skip to content

Commit

Permalink
fix Chinese annotation on runtime module
Browse files Browse the repository at this point in the history
  • Loading branch information
Roc-00 committed Jul 14, 2021
1 parent 4b82183 commit fad0381
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 43 deletions.
8 changes: 4 additions & 4 deletions eventmesh-runtime/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# Java Environment Setting
#===========================================================================================
set -e
#服务器配置可能不一致,增加这些配置避免乱码问题
#Server configuration may be inconsistent, add these configurations to avoid garbled code problems
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Expand Down Expand Up @@ -69,13 +69,13 @@ function get_pid {
ppid=$(cat ${EVENTMESH_HOME}/bin/pid.file)
else
if [[ $OS =~ Msys ]]; then
# 在Msys上存在可能无法kill识别出的进程的BUG
# There is a Bug on Msys that may not be able to kill the identified process
ppid=`jps -v | grep -i "org.apache.eventmesh.runtime.boot.EventMeshStartup" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
elif [[ $OS =~ Darwin ]]; then
# 已知问题:grep java 可能无法精确识别java进程
# Known problem: grep Java may not be able to accurately identify Java processes
ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.runtime.boot.EventMeshStartup" | grep -Ev "^root" |awk -F ' ' {'print $2'})
else
#在Linux服务器上要求尽可能精确识别进程
# It is required to identify the process as accurately as possible on Linux
ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_HOME | grep -i "org.apache.eventmesh.runtime.boot.EventMeshStartup" | grep -Ev "^root" |awk -F ' ' {'print $2'})
fi
fi
Expand Down
6 changes: 3 additions & 3 deletions eventmesh-runtime/bin/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ function get_pid {
ppid=$(cat ${EVENTMESH_HOME}/bin/pid.file)
else
if [[ $OS =~ Msys ]]; then
# 在Msys上存在可能无法kill识别出的进程的BUG
# There is a Bug on Msys that may not be able to kill the identified process
ppid=`jps -v | grep -i "org.apache.eventmesh.runtime.boot.EventMeshStartup" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
elif [[ $OS =~ Darwin ]]; then
# 已知问题:grep java 可能无法精确识别java进程
# Known problem: grep Java may not be able to accurately identify Java processes
ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.runtime.boot.EventMeshStartup" | grep -Ev "^root" |awk -F ' ' {'print $2'})
else
#在Linux服务器上要求尽可能精确识别进程
# It is required to identify the process as accurately as possible on Linux
ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_HOME | grep -i "org.apache.eventmesh.runtime.boot.EventMeshStartup" | grep -Ev "^root" |awk -F ' ' {'print $2'})
fi
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void run() {
boolean isChange = false;
while (clientIterator.hasNext()) {
Client client = clientIterator.next();
//时间差大于3次心跳周期
//The time difference is greater than 3 heartbeat cycles
if (System.currentTimeMillis() - client.lastUpTime.getTime() > DEFAULT_UPDATE_TIME) {
logger.warn("client {} lastUpdate time {} over three heartbeat cycles",
JSONObject.toJSONString(client), client.lastUpTime);
Expand Down Expand Up @@ -152,7 +152,7 @@ public void run() {
}

/**
* notify ConsumerManager 组级别
* notify ConsumerManager groupLevel
*/
public void notifyConsumerManager(String consumerGroup, ConsumerGroupConf latestConsumerGroupConfig,
ConcurrentHashMap<String, ConsumerGroupConf> localConsumerGroupMapping) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void processRequest(ChannelHandlerContext ctx, AsyncContext<HttpCommand>
IPUtil.getLocalAddress(), eventMeshHTTPServer.getEventMeshHttpConfiguration().eventMeshEnv,
eventMeshHTTPServer.getEventMeshHttpConfiguration().eventMeshIDC);

//HEADER校验
//validate HEADER
if (StringUtils.isBlank(replyMessageRequestHeader.getIdc())
|| StringUtils.isBlank(replyMessageRequestHeader.getPid())
|| !StringUtils.isNumeric(replyMessageRequestHeader.getPid())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void processRequest(ChannelHandlerContext ctx, AsyncContext<HttpCommand>
}
ConsumerGroupConf consumerGroupConf = eventMeshHTTPServer.localConsumerGroupMapping.get(consumerGroup);
if (consumerGroupConf == null) {
// 新订阅
// new subscription
consumerGroupConf = new ConsumerGroupConf(consumerGroup);
ConsumerGroupTopicConf consumeTopicConfig = new ConsumerGroupTopicConf();
consumeTopicConfig.setConsumerGroup(consumerGroup);
Expand All @@ -140,7 +140,7 @@ public void processRequest(ChannelHandlerContext ctx, AsyncContext<HttpCommand>
map.put(subTopic.getTopic(), consumeTopicConfig);
consumerGroupConf.setConsumerGroupTopicConf(map);
} else {
// 已有订阅
// already subscribed
Map<String, ConsumerGroupTopicConf> map = consumerGroupConf.getConsumerGroupTopicConf();
for (String key : map.keySet()) {
if (StringUtils.equals(subTopic.getTopic(), key)) {
Expand All @@ -163,7 +163,7 @@ public void processRequest(ChannelHandlerContext ctx, AsyncContext<HttpCommand>

long startTime = System.currentTimeMillis();
try {
// 订阅关系变化通知
// subscription relationship change notification
eventMeshHTTPServer.getConsumerManager().notifyConsumerManager(consumerGroup, eventMeshHTTPServer.localConsumerGroupMapping.get(consumerGroup),
eventMeshHTTPServer.localConsumerGroupMapping);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void onResponse(HttpCommand httpCommand) {
Map<String, List<String>> idcUrls = new HashMap<>();
Set<String> clientUrls = new HashSet<>();
for (Client client : groupTopicClients) {
// 去除订阅的url
// remove subscribed url
if (!StringUtils.equals(unSubscribeUrl, client.url)) {
clientUrls.add(client.url);
if (idcUrls.containsKey(client.idc)) {
Expand All @@ -158,7 +158,7 @@ public void onResponse(HttpCommand httpCommand) {
ConsumerGroupConf consumerGroupConf = eventMeshHTTPServer.localConsumerGroupMapping.get(consumerGroup);
Map<String, ConsumerGroupTopicConf> map = consumerGroupConf.getConsumerGroupTopicConf();
for (String topicKey : map.keySet()) {
// 仅修改去订阅的topic
// only modify the topic to subscribe
if (StringUtils.equals(unSubTopic, topicKey)) {
ConsumerGroupTopicConf latestTopicConf = new ConsumerGroupTopicConf();
latestTopicConf.setConsumerGroup(consumerGroup);
Expand Down Expand Up @@ -209,9 +209,9 @@ public void onResponse(HttpCommand httpCommand) {
responseEventMeshCommand = asyncContext.getRequest().createHttpCommandResponse(
EventMeshRetCode.SUCCESS.getRetCode(), EventMeshRetCode.SUCCESS.getErrMsg());
asyncContext.onComplete(responseEventMeshCommand, handler);
// 清理ClientInfo
// clean ClientInfo
eventMeshHTTPServer.localClientInfoMapping.keySet().removeIf(s -> StringUtils.contains(s, consumerGroup));
// 清理ConsumerGroupInfo
// clean ConsumerGroupInfo
eventMeshHTTPServer.localConsumerGroupMapping.keySet().removeIf(s -> StringUtils.equals(consumerGroup, s));
} catch (Exception e) {
HttpCommand err = asyncContext.getRequest().createHttpCommandResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

public interface DownstreamDispatchStrategy {
/**
* 选择一个SESSION
* select a SESSION
*
* @param group
* @param consumeSessions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ private void retryHandle(DownStreamMsgContext downStreamMsgContext) {
if (rechoosen == null) {
logger.warn("retry, found no session to downstream msg,seq:{}, retryTimes:{}, bizSeq:{}", downStreamMsgContext.seq, downStreamMsgContext.retryTimes, EventMeshUtil.getMessageBizSeq(downStreamMsgContext.msgExt));

// //需要手动ack掉没有下发成功的消息
// //Need to manually ack the message that did not send a successful message
// eventMeshAckMsg(downStreamMsgContext);

// //重试找不到下发session不再回发broker或者重试其它eventMesh
// //Retry cannot find the delivered session, no longer post back to the broker or retry other event Mesh
// String bizSeqNo = finalDownStreamMsgContext.msgExt.getKeys();
// String uniqueId = MapUtils.getString(finalDownStreamMsgContext.msgExt.getProperties(), WeMQConstant.RMB_UNIQ_ID, "");
// if(EventMeshTCPServer.getAccessConfiguration().eventMeshTcpSendBackEnabled){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ private float avg(LinkedList<Integer> linkedList) {
}

////////////////////////////////////////////////////////////////////////////////
public static final String EVENTMESH_MONITOR_FORMAT_HTTP = "{\"maxHTTPTPS\":\"%.1f\",\"avgHTTPTPS\":\"%.1f\"," + //EVENTMESH 接受外部HTTP 请求的TPS相关
public static final String EVENTMESH_MONITOR_FORMAT_HTTP = "{\"maxHTTPTPS\":\"%.1f\",\"avgHTTPTPS\":\"%.1f\"," + //EVENTMESH tps related to accepting external http requests
"\"maxHTTPCOST\":\"%s\",\"avgHTTPCOST\":\"%.1f\",\"avgHTTPBodyDecodeCost\":\"%.1f\", \"httpDiscard\":\"%s\"}";

private float wholeCost = 0f;

private AtomicLong wholeRequestNum = new AtomicLong(0);

//累计值
//cumulative value
private AtomicLong httpDiscard = new AtomicLong(0);

private AtomicLong maxCost = new AtomicLong(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private float avg(LinkedList<Integer> linkedList) {
}

////////////////////////////////////////////////////////////////////////////////
public static final String EVENTMESH_MONITOR_FORMAT_HTTP = "%15s : {\"maxHTTPTPS\":\"%.1f\",\"avgHTTPTPS\":\"%.1f\"," + //EVENTMESH 接受外部HTTP 请求的TPS相关
public static final String EVENTMESH_MONITOR_FORMAT_HTTP = "%15s : {\"maxHTTPTPS\":\"%.1f\",\"avgHTTPTPS\":\"%.1f\"," + //EVENTMESH tps related to accepting external http requests
"\"maxHTTPCOST\":\"%s\",\"avgHTTPCOST\":\"%.1f\",\"avgHTTPBodyDecodeCost\":\"%.1f\"}";

private float wholeCost = 0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static String buildClientGroup(String systemId) {
}

/**
* 自定义取堆栈
* custom fetch stack
*
* @param e
* @return
Expand Down Expand Up @@ -119,7 +119,7 @@ public static ObjectMapper createJsoner() {


/**
* 打印mq消息的一部分内容
* print part of the mq message
*
* @param eventMeshMessage
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class Utils {
private final static Logger messageLogger = LoggerFactory.getLogger("message");

/**
* 用于向客户端发送消息
* used to send messages to the client
*
* @param pkg
* @param startTime
Expand Down Expand Up @@ -75,7 +75,7 @@ public void operationComplete(ChannelFuture future) throws Exception {
}

/**
* 打印发送失败的消息流水
* print the message flow of failed sending
*
* @param future
* @param pkg
Expand All @@ -97,7 +97,7 @@ private static void logFailedMessageFlow(Package pkg, UserAgent user, long start
}

/**
* 打印发送发成的消息流水
* print the message flow of successful sending
*
* @param pkg
* @param user
Expand Down Expand Up @@ -147,7 +147,7 @@ public static void logSucceedMessageFlow(Package pkg, UserAgent user, long start
// }

/**
* 打印mq消息的一部分内容
* print part of the mq message
*
* @param eventMeshMessage
* @return
Expand All @@ -166,7 +166,7 @@ public static String printMqMessage(EventMeshMessage eventMeshMessage) {
}

/**
* 打印mq消息的一部分内容
* print part of the mq message
*
* @param message
* @return
Expand All @@ -180,7 +180,7 @@ public static String printMqMessage(EventMeshMessage eventMeshMessage) {
// }

/**
* 根据topic获取serviceId
* get serviceId according to topic
*/
public static String getServiceId(String topic) {
String[] topicStrArr = topic.split("-");
Expand Down
4 changes: 2 additions & 2 deletions eventmesh-runtime/src/test/java/client/common/TCPClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@


/**
* 一个Client连一个ACCESS
* 提供最基础的连接, send能力, 不能提供断线重连能力, 该业务是具备请求依赖的,如果提供了断线重连能力,会引起业务上的无感知,即不会走业务上的重连逻辑
* one Client connects one ACCESS
* Provides the most basic connection, send capability, and cannot provide disconnected reconnection capability, The service is request-dependent. If the disconnection and reconnection capability is provided, it will cause business insensitivity, that is, it will not follow the business reconnection logic.
*/
public abstract class TCPClient implements Closeable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.eventmesh.common.protocol.tcp.Package;

/**
* 业务回调钩子, 这是针对所有类型的消息都会进行的回调
* Business callback hook, which is a callback for all types of messages
*/
public interface ReceiveMsgHook {
void handle(Package msg, ChannelHandlerContext ctx);
Expand Down
10 changes: 5 additions & 5 deletions eventmesh-runtime/src/test/java/client/impl/PubClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private void hello() throws Exception {
}

/**
* 发送RR消息
* send RR message
*/
@Override
public Package rr(Package msg, long timeout) throws Exception {
Expand All @@ -120,7 +120,7 @@ public Package rr(Package msg, long timeout) throws Exception {
}

/**
* 在原本的IO基础上增加测试用例的断言
* Add test case assertions on the basis of the original IO
*/
public Package dispatcher(Package request, long timeout) throws Exception {
Assert.assertNotNull(request);
Expand Down Expand Up @@ -157,15 +157,15 @@ public Package dispatcher(Package request, long timeout) throws Exception {
}

/**
* 发送事件消息, 有返回值是ACCESS 给了ACK
* Send an event message, the return value is ACCESS and ACK is given
*/
public Package publish(Package msg, long timeout) throws Exception {
publogger.info("PubClientImpl|{}|publish|send|command={}|msg={}", clientNo, msg.getHeader().getCommand(), msg);
return dispatcher(msg, timeout);
}

/**
* 发送广播消息
* send broadcast message
*/
public Package broadcast(Package msg, long timeout) throws Exception {
publogger.info("PubClientImpl|{}|broadcast|send|type={}|msg={}", clientNo, msg.getHeader().getCommand(), msg);
Expand All @@ -187,7 +187,7 @@ protected void channelRead0(ChannelHandlerContext ctx, Package msg) throws Excep
callback.handle(msg, ctx);
}
/**
* RR发送接受回包, 并Ack
* RR send and accept the return packet ,and Ack
*/
if (cmd == Command.RESPONSE_TO_CLIENT) {
Package responseToClientAck = MessageUtils.responseToClientAck(msg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ protected void channelRead0(ChannelHandlerContext ctx, Package msg) throws Excep
System.err.println("server goodby request: ---------------------------" + msg.toString());
close();
} else {
//控制指令集
//control instruction set
RequestContext context = contexts.get(RequestContext._key(msg));
if (context != null) {
contexts.remove(context.getKey());
Expand Down
6 changes: 3 additions & 3 deletions eventmesh-runtime/src/test/java/demo/CClientDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import client.impl.EventMeshClientImpl;

/**
* SIMPLE客户端使用样例
* simple client usage example
*/
public class CClientDemo {

Expand Down Expand Up @@ -71,9 +71,9 @@ public void handle(Package msg, ChannelHandlerContext ctx) {
});
for (int i = 0; i < 10000; i++) {
// ThreadUtil.randomSleep(0,200);
//广播消息
//broadcast message
client.broadcast(MessageUtils.broadcastMessage("TEST-TOPIC-TCP-BROADCAST", i), 5000);
//异步消息
//asynchronous message
client.publish(MessageUtils.asyncMessage(ASYNC_TOPIC, i), 5000);
}
//
Expand Down

0 comments on commit fad0381

Please sign in to comment.