This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 4379e21 Name threads in ConnectionThreadExecutorGroup (#10533)
4379e21 is described below
commit 4379e214456d16fb1500d8cab3cb0254b46add09
Author: 吴伟杰 <[email protected]>
AuthorDate: Fri May 28 19:58:46 2021 +0800
Name threads in ConnectionThreadExecutorGroup (#10533)
---
.../proxy/frontend/executor/ConnectionThreadExecutorGroup.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/executor/ConnectionThreadExecutorGroup.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/executor/ConnectionThreadExecutorGroup.java
index f1e325b..af93e52 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/executor/ConnectionThreadExecutorGroup.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/executor/ConnectionThreadExecutorGroup.java
@@ -23,7 +23,8 @@ import lombok.NoArgsConstructor;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
@@ -56,7 +57,11 @@ public final class ConnectionThreadExecutorGroup {
* @param connectionId connection id
*/
public void register(final int connectionId) {
- executorServices.put(connectionId,
Executors.newSingleThreadExecutor());
+ executorServices.put(connectionId,
newSingleThreadExecutorService(connectionId));
+ }
+
+ private ExecutorService newSingleThreadExecutorService(final int
connectionId) {
+ return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new
LinkedBlockingQueue<>(), runnable -> new Thread(runnable,
String.format("Connection-%d-ThreadExecutor", connectionId)));
}
/**