Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
holden_csdn
tx-lcn
提交
a254c1b0
T
tx-lcn
项目概览
holden_csdn
/
tx-lcn
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tx-lcn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a254c1b0
编写于
9月 13, 2020
作者:
W
whomhim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix( #506 ): 修复只连上一个 TM 节点时,还负载均衡的问题
上级
faeebb5f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
23 addition
and
9 deletion
+23
-9
txlcn-protocol/src/main/java/com/codingapi/txlcn/protocol/message/separate/AbsMessage.java
...codingapi/txlcn/protocol/message/separate/AbsMessage.java
+0
-4
txlcn-protocol/src/main/java/com/codingapi/txlcn/protocol/message/separate/TransactionMessage.java
...i/txlcn/protocol/message/separate/TransactionMessage.java
+1
-1
txlcn-protocol/src/main/java/com/codingapi/txlcn/protocol/service/ConnectionService.java
...m/codingapi/txlcn/protocol/service/ConnectionService.java
+1
-1
txlcn-tm/src/main/java/com/codingapi/txlcn/tm/loadbalancer/EventStatus.java
...java/com/codingapi/txlcn/tm/loadbalancer/EventStatus.java
+7
-0
txlcn-tm/src/main/java/com/codingapi/txlcn/tm/loadbalancer/EventStatusHandler.java
...m/codingapi/txlcn/tm/loadbalancer/EventStatusHandler.java
+6
-0
txlcn-tm/src/main/java/com/codingapi/txlcn/tm/loadbalancer/LoadBalancerInterceptor.java
...ingapi/txlcn/tm/loadbalancer/LoadBalancerInterceptor.java
+8
-3
未找到文件。
txlcn-protocol/src/main/java/com/codingapi/txlcn/protocol/message/separate/AbsMessage.java
浏览文件 @
a254c1b0
...
...
@@ -31,10 +31,6 @@ public abstract class AbsMessage implements Message {
*/
protected
Boolean
isReadyCallBack
=
false
;
protected
Connection
tcConnection
;
protected
String
firstConnectionKey
;
protected
String
messageId
;
protected
String
firstMessageId
;
...
...
txlcn-protocol/src/main/java/com/codingapi/txlcn/protocol/message/separate/TransactionMessage.java
浏览文件 @
a254c1b0
...
...
@@ -15,7 +15,7 @@ import org.springframework.context.ApplicationContext;
*/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
public
class
TransactionMessage
extends
AbsMessage
{
public
class
TransactionMessage
extends
AbsMessage
{
protected
String
groupId
;
...
...
txlcn-protocol/src/main/java/com/codingapi/txlcn/protocol/service/ConnectionService.java
浏览文件 @
a254c1b0
...
...
@@ -17,7 +17,7 @@ import java.util.Map;
public
class
ConnectionService
{
// server name -> connection
private
final
Map
<
String
,
Connection
>
connections
=
new
HashMap
<
String
,
Connection
>();
private
final
Map
<
String
,
Connection
>
connections
=
new
HashMap
<>();
public
void
addConnection
(
final
Connection
connection
)
{
final
String
uniqueKey
=
connection
.
getUniqueKey
();
...
...
txlcn-tm/src/main/java/com/codingapi/txlcn/tm/loadbalancer/EventStatus.java
浏览文件 @
a254c1b0
...
...
@@ -36,4 +36,11 @@ public interface EventStatus {
* @param firstConnectionKeyTmp 暂时保存 ConnectionUniKey
*/
void
onReadyCallBack
(
AbsMessage
absMessage
,
Protocoler
protocoler
,
String
firstConnectionKeyTmp
);
/**
* TM 节点只连接了一个 TC 时
*
* @param event EventService
*/
void
onOneConnection
(
EventService
event
)
throws
Exception
;
}
txlcn-tm/src/main/java/com/codingapi/txlcn/tm/loadbalancer/EventStatusHandler.java
浏览文件 @
a254c1b0
...
...
@@ -58,6 +58,12 @@ public class EventStatusHandler implements EventStatus {
}
}
@Override
public
void
onOneConnection
(
EventService
event
)
throws
Exception
{
log
.
debug
(
"EventStatusHandler.onOneConnection"
);
event
.
execute
();
}
/**
* 判断 AbsMessage 是来自哪个事件的,并 new 一个该事件
*
...
...
txlcn-tm/src/main/java/com/codingapi/txlcn/tm/loadbalancer/LoadBalancerInterceptor.java
浏览文件 @
a254c1b0
...
...
@@ -43,9 +43,14 @@ public class LoadBalancerInterceptor implements EventInterceptor {
throws
Exception
{
String
firstConnectionKeyTmp
=
connection
.
getUniqueKey
();
String
firstMessageIdTmp
=
absMessage
.
getMessageId
();
eventStatus
.
onFirstNode
(
absMessage
,
firstMessageIdTmp
,
connection
);
eventStatus
.
onBusinessExecuted
(
absMessage
,
event
);
eventStatus
.
onReadyCallBack
(
absMessage
,
protocoler
,
firstConnectionKeyTmp
);
if
(
protocoler
.
getConnections
().
size
()
==
1
)
{
eventStatus
.
onOneConnection
(
event
);
}
else
{
eventStatus
.
onFirstNode
(
absMessage
,
firstMessageIdTmp
,
connection
);
eventStatus
.
onBusinessExecuted
(
absMessage
,
event
);
eventStatus
.
onReadyCallBack
(
absMessage
,
protocoler
,
firstConnectionKeyTmp
);
}
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录