Skip to content

Commit 464a3e1

Browse files
authored
Merge branch '2.x' into 20250605
2 parents 4a78045 + 09d30ca commit 464a3e1

File tree

8 files changed

+20
-39
lines changed

8 files changed

+20
-39
lines changed

changes/en-us/2.x.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ Add changes here for all PR submitted to the 2.x branch.
4848
- [[#7360](https://github.com/apache/incubator-seata/pull/7360)] Update resource cleanup logic for channel disconnection
4949
- [[#7363](https://github.com/apache/incubator-seata/pull/7363)] Upgrade npmjs dependencies
5050
- [[#7372](https://github.com/apache/incubator-seata/pull/7372)] optimize license ignore
51+
- [[#7388](https://github.com/apache/incubator-seata/pull/7388)] optimize binary packaging directory structure
5152
- [[#7412](https://github.com/apache/incubator-seata/pull/7412)] Helm template adapted to the new version of seata
53+
- [[#7414](https://github.com/apache/incubator-seata/pull/7414)] Remove the unused defaultEventExecutorGroup from the NettyClientBootstrap
5254
- [[#7415](https://github.com/apache/incubator-seata/pull/7415)] Use threadPool to asynchronously process server http requests
5355

56+
5457
### security:
5558

5659
- [[#PR_NO](https://github.com/seata/seata/pull/PR_NO)] upgrade XXX
@@ -103,5 +106,6 @@ Thanks to these contributors for their code commits. Please report an unintended
103106
- [PleaseGiveMeTheCoke](https://github.com/PleaseGiveMeTheCoke)
104107
- [funky-eyes](https://github.com/funky-eyes)
105108
- [xucq07](https://github.com/xucq07)
109+
- [PengningYang](https://github.com/PengningYang)
106110

107111
Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.

changes/zh-cn/2.x.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
- [[#7360](https://github.com/apache/incubator-seata/pull/7360)] 更新通道断开连接时的资源清理逻辑
4949
- [[#7363](https://github.com/apache/incubator-seata/pull/7363)] 升级 npmjs 依赖项
5050
- [[#7372](https://github.com/apache/incubator-seata/pull/7372)] 改进忽略许可证标头检查
51+
- [[#7388](https://github.com/apache/incubator-seata/pull/7388)] 优化二进制打包目录结构
5152
- [[#7412](https://github.com/apache/incubator-seata/pull/7412)] 适配新版本 Seata 的 Helm 模板
53+
- [[#7414](https://github.com/apache/incubator-seata/pull/7414)] 移除 NettyClientBootstrap 中 defaultEventExecutorGroup
5254
- [[#7415](https://github.com/apache/incubator-seata/pull/7415)] 使用线程池异步处理server http请求
5355

5456

@@ -105,6 +107,7 @@
105107
- [PleaseGiveMeTheCoke](https://github.com/PleaseGiveMeTheCoke)
106108
- [funky-eyes](https://github.com/funky-eyes)
107109
- [xucq07](https://github.com/xucq07)
110+
- [PengningYang](https://github.com/PengningYang)
108111

109112

110113
同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。

core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingClient.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import io.netty.channel.ChannelPromise;
2828
import io.netty.handler.timeout.IdleState;
2929
import io.netty.handler.timeout.IdleStateEvent;
30-
import io.netty.util.concurrent.EventExecutorGroup;
3130
import java.lang.reflect.Field;
3231
import java.net.InetSocketAddress;
3332
import java.util.HashSet;
@@ -143,12 +142,11 @@ public void init() {
143142

144143
public AbstractNettyRemotingClient(
145144
NettyClientConfig nettyClientConfig,
146-
EventExecutorGroup eventExecutorGroup,
147145
ThreadPoolExecutor messageExecutor,
148146
NettyPoolKey.TransactionRole transactionRole) {
149147
super(messageExecutor);
150148
this.transactionRole = transactionRole;
151-
clientBootstrap = new NettyClientBootstrap(nettyClientConfig, eventExecutorGroup, transactionRole);
149+
clientBootstrap = new NettyClientBootstrap(nettyClientConfig, transactionRole);
152150
clientBootstrap.setChannelHandlers(new ClientHandler(), new ChannelEventHandler(this));
153151
clientChannelManager = new NettyClientChannelManager(
154152
new NettyPoolableFactory(this, clientBootstrap), getPoolKeyFunction(), nettyClientConfig);

core/src/main/java/org/apache/seata/core/rpc/netty/NettyClientBootstrap.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
import io.netty.handler.codec.http2.Http2MultiplexHandler;
3737
import io.netty.handler.codec.http2.Http2StreamChannelBootstrap;
3838
import io.netty.handler.timeout.IdleStateHandler;
39-
import io.netty.util.concurrent.DefaultEventExecutorGroup;
40-
import io.netty.util.concurrent.EventExecutorGroup;
4139
import io.netty.util.internal.PlatformDependent;
4240
import org.apache.seata.common.exception.FrameworkException;
4341
import org.apache.seata.common.thread.NamedThreadFactory;
@@ -69,11 +67,9 @@ public class NettyClientBootstrap implements RemotingBootstrap {
6967
private final AtomicBoolean initialized = new AtomicBoolean(false);
7068
private final NettyPoolKey.TransactionRole transactionRole;
7169
private final EventLoopGroup eventLoopGroupWorker;
72-
73-
private EventExecutorGroup defaultEventExecutorGroup;
7470
private ChannelHandler[] channelHandlers;
7571

76-
public NettyClientBootstrap(NettyClientConfig nettyClientConfig, final EventExecutorGroup eventExecutorGroup,
72+
public NettyClientBootstrap(NettyClientConfig nettyClientConfig,
7773
NettyPoolKey.TransactionRole transactionRole) {
7874
if (nettyClientConfig == null) {
7975
nettyClientConfig = new NettyClientConfig();
@@ -94,7 +90,6 @@ public NettyClientBootstrap(NettyClientConfig nettyClientConfig, final EventExec
9490
} else {
9591
eventLoopGroupWorker = createEventLoopGroupWorker(selectorThreadSizeThreadSize);
9692
}
97-
this.defaultEventExecutorGroup = eventExecutorGroup;
9893
}
9994

10095
/**
@@ -122,11 +117,6 @@ private void addChannelPipelineLast(Channel channel, ChannelHandler... handlers)
122117

123118
@Override
124119
public void start() {
125-
if (this.defaultEventExecutorGroup == null) {
126-
this.defaultEventExecutorGroup = new DefaultEventExecutorGroup(nettyClientConfig.getClientWorkerThreads(),
127-
new NamedThreadFactory(getThreadPrefix(nettyClientConfig.getClientWorkerThreadPrefix()),
128-
nettyClientConfig.getClientWorkerThreads()));
129-
}
130120
this.bootstrap.group(eventLoopGroupWorker).channel(
131121
nettyClientConfig.getClientChannelClazz()).option(
132122
ChannelOption.TCP_NODELAY, true).option(ChannelOption.SO_KEEPALIVE, true).option(
@@ -175,9 +165,6 @@ public void initChannel(SocketChannel ch) {
175165
public void shutdown() {
176166
try {
177167
eventLoopGroupWorker.shutdownGracefully();
178-
if (this.defaultEventExecutorGroup != null) {
179-
this.defaultEventExecutorGroup.shutdownGracefully();
180-
}
181168
} catch (Exception exx) {
182169
LOGGER.error("Failed to shutdown: {}", exx.getMessage());
183170
}

core/src/main/java/org/apache/seata/core/rpc/netty/RmNettyRemotingClient.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.util.function.Function;
2626

2727
import io.netty.channel.Channel;
28-
import io.netty.util.concurrent.EventExecutorGroup;
2928
import org.apache.seata.common.DefaultValues;
3029
import org.apache.seata.common.exception.FrameworkErrorCode;
3130
import org.apache.seata.common.exception.FrameworkException;
@@ -108,9 +107,9 @@ public void init() {
108107
});
109108
}
110109

111-
private RmNettyRemotingClient(NettyClientConfig nettyClientConfig, EventExecutorGroup eventExecutorGroup,
110+
private RmNettyRemotingClient(NettyClientConfig nettyClientConfig,
112111
ThreadPoolExecutor messageExecutor) {
113-
super(nettyClientConfig, eventExecutorGroup, messageExecutor, TransactionRole.RMROLE);
112+
super(nettyClientConfig, messageExecutor, TransactionRole.RMROLE);
114113
// set enableClientBatchSendRequest
115114
Configuration configuration = ConfigurationFactory.getInstance();
116115
this.enableClientBatchSendRequest = configuration.getBoolean(ConfigurationKeys.ENABLE_RM_CLIENT_BATCH_SEND_REQUEST,
@@ -156,7 +155,7 @@ public static RmNettyRemotingClient getInstance() {
156155
KEEP_ALIVE_TIME, TimeUnit.SECONDS, new LinkedBlockingQueue<>(MAX_QUEUE_SIZE),
157156
new NamedThreadFactory(nettyClientConfig.getRmDispatchThreadPrefix(),
158157
nettyClientConfig.getClientWorkerThreads()), new ThreadPoolExecutor.CallerRunsPolicy());
159-
instance = new RmNettyRemotingClient(nettyClientConfig, null, messageExecutor);
158+
instance = new RmNettyRemotingClient(nettyClientConfig, messageExecutor);
160159
}
161160
}
162161
}

core/src/main/java/org/apache/seata/core/rpc/netty/TmNettyRemotingClient.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.function.Function;
2424

2525
import io.netty.channel.Channel;
26-
import io.netty.util.concurrent.EventExecutorGroup;
2726
import org.apache.commons.lang.StringUtils;
2827
import org.apache.seata.common.DefaultValues;
2928
import org.apache.seata.common.exception.FrameworkException;
@@ -66,9 +65,8 @@ public final class TmNettyRemotingClient extends AbstractNettyRemotingClient {
6665

6766

6867
private TmNettyRemotingClient(NettyClientConfig nettyClientConfig,
69-
EventExecutorGroup eventExecutorGroup,
7068
ThreadPoolExecutor messageExecutor) {
71-
super(nettyClientConfig, eventExecutorGroup, messageExecutor, NettyPoolKey.TransactionRole.TMROLE);
69+
super(nettyClientConfig, messageExecutor, NettyPoolKey.TransactionRole.TMROLE);
7270
this.signer = EnhancedServiceLoader.load(AuthSigner.class);
7371
// set enableClientBatchSendRequest
7472
Configuration configuration = ConfigurationFactory.getInstance();
@@ -152,7 +150,7 @@ public static TmNettyRemotingClient getInstance() {
152150
new NamedThreadFactory(nettyClientConfig.getTmDispatchThreadPrefix(),
153151
nettyClientConfig.getClientWorkerThreads()),
154152
RejectedPolicies.runsOldestTaskPolicy());
155-
instance = new TmNettyRemotingClient(nettyClientConfig, null, messageExecutor);
153+
instance = new TmNettyRemotingClient(nettyClientConfig, messageExecutor);
156154
}
157155
}
158156
}

core/src/test/java/org/apache/seata/core/rpc/netty/NettyClientBootstrapTest.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
package org.apache.seata.core.rpc.netty;
1818

1919
import io.netty.channel.EventLoopGroup;
20-
import io.netty.util.concurrent.DefaultEventExecutorGroup;
2120
import org.junit.jupiter.api.Assertions;
22-
import org.junit.jupiter.api.BeforeEach;
2321
import org.junit.jupiter.api.Test;
2422
import org.junit.jupiter.api.extension.ExtendWith;
2523
import org.mockito.Mock;
@@ -32,20 +30,13 @@ class NettyClientBootstrapTest {
3230

3331
@Mock
3432
private NettyClientConfig nettyClientConfig;
35-
private DefaultEventExecutorGroup eventExecutorGroup;
36-
37-
@BeforeEach
38-
void init() {
39-
eventExecutorGroup = new DefaultEventExecutorGroup(1);
40-
}
41-
4233
@Test
4334
void testSharedEventLoopGroupEnabled() {
4435
when(nettyClientConfig.getEnableClientSharedEventLoop()).thenReturn(true);
45-
NettyClientBootstrap tmNettyClientBootstrap = new NettyClientBootstrap(nettyClientConfig, eventExecutorGroup, NettyPoolKey.TransactionRole.TMROLE);
36+
NettyClientBootstrap tmNettyClientBootstrap = new NettyClientBootstrap(nettyClientConfig, NettyPoolKey.TransactionRole.TMROLE);
4637
EventLoopGroup tmEventLoopGroupWorker = getEventLoopGroupWorker(tmNettyClientBootstrap);
4738

48-
NettyClientBootstrap rmNettyClientBootstrap = new NettyClientBootstrap(nettyClientConfig, eventExecutorGroup, NettyPoolKey.TransactionRole.RMROLE);
39+
NettyClientBootstrap rmNettyClientBootstrap = new NettyClientBootstrap(nettyClientConfig, NettyPoolKey.TransactionRole.RMROLE);
4940
EventLoopGroup rmEventLoopGroupWorker = getEventLoopGroupWorker(rmNettyClientBootstrap);
5041

5142
Assertions.assertEquals(tmEventLoopGroupWorker, rmEventLoopGroupWorker);
@@ -54,10 +45,10 @@ void testSharedEventLoopGroupEnabled() {
5445
@Test
5546
void testSharedEventLoopGroupDisabled() {
5647
when(nettyClientConfig.getEnableClientSharedEventLoop()).thenReturn(false);
57-
NettyClientBootstrap tmNettyClientBootstrap = new NettyClientBootstrap(nettyClientConfig, eventExecutorGroup, NettyPoolKey.TransactionRole.TMROLE);
48+
NettyClientBootstrap tmNettyClientBootstrap = new NettyClientBootstrap(nettyClientConfig, NettyPoolKey.TransactionRole.TMROLE);
5849
EventLoopGroup tmEventLoopGroupWorker = getEventLoopGroupWorker(tmNettyClientBootstrap);
5950

60-
NettyClientBootstrap rmNettyClientBootstrap = new NettyClientBootstrap(nettyClientConfig, eventExecutorGroup, NettyPoolKey.TransactionRole.RMROLE);
51+
NettyClientBootstrap rmNettyClientBootstrap = new NettyClientBootstrap(nettyClientConfig, NettyPoolKey.TransactionRole.RMROLE);
6152
EventLoopGroup rmEventLoopGroupWorker = getEventLoopGroupWorker(rmNettyClientBootstrap);
6253

6354
Assertions.assertNotEquals(tmEventLoopGroupWorker, rmEventLoopGroupWorker);

distribution/release-seata.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
-->
2020
<assembly>
2121
<id>${project.version}-incubating-bin</id>
22-
<includeBaseDirectory>false</includeBaseDirectory>
22+
<includeBaseDirectory>true</includeBaseDirectory>
23+
<baseDirectory>apache-seata-${project.version}-incubating-bin</baseDirectory>
2324
<formats>
2425
<format>dir</format>
2526
<format>tar.gz</format>

0 commit comments

Comments
 (0)