You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by "mxsm (via GitHub)" <gi...@apache.org> on 2023/02/19 15:53:39 UTC

[GitHub] [incubator-eventmesh] mxsm opened a new pull request, #3207: [ISSUE #3201]Optimize remote service related code

mxsm opened a new pull request, #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207

   <!--
   ### Contribution Checklist
   
     - Name the pull request in the form "[ISSUE #XXXX] Title of the pull request", 
       where *XXXX* should be replaced by the actual issue number.
       Skip *[ISSUE #XXXX]* if there is no associated github issue for this pull request.
   
     - Fill out the template below to describe the changes contributed by the pull request. 
       That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue. 
       Please do not mix up code from multiple issues.
     
     - Each commit in the pull request should have a meaningful commit message.
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, 
       leaving only the filled out template below.
   
   (The sections below can be removed for hotfixes of typos)
   -->
   
   <!--
   (If this PR fixes a GitHub issue, please add `Fixes #<XXX>` or `Closes #<XXX>`.)
   -->
   
   Fixes #3201 
   ### Motivation
   
   *Explain the content here.*
   *Explain why you want to make the changes and what problem you're trying to solve.*
   
   
   
   ### Modifications
   
   
   Optimize remote service related code
   
   
   ### Documentation
   
   - Does this pull request introduce a new feature? (yes / no)
   - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
   - If a feature is not applicable for documentation, explain why?
   - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] codecov[bot] commented on pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#issuecomment-1436032825

   # [Codecov](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3207](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (51a9f0d) into [master](https://codecov.io/gh/apache/incubator-eventmesh/commit/ab549871abf1a89cae882e9d148eaf0278cfba24?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab54987) will **increase** coverage by `0.00%`.
   > The diff coverage is `4.81%`.
   
   > :exclamation: Current head 51a9f0d differs from pull request most recent head 202d46d. Consider uploading reports for the commit 202d46d to get more accurate results
   
   ```diff
   @@            Coverage Diff            @@
   ##             master    #3207   +/-   ##
   =========================================
     Coverage     13.02%   13.03%           
   - Complexity     1154     1158    +4     
   =========================================
     Files           548      549    +1     
     Lines         28764    28785   +21     
     Branches       2857     2853    -4     
   =========================================
   + Hits           3747     3751    +4     
   - Misses        24694    24711   +17     
     Partials        323      323           
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...org/apache/eventmesh/common/utils/ThreadUtils.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2NvbW1vbi91dGlscy9UaHJlYWRVdGlscy5qYXZh) | `22.22% <0.00%> (ø)` | |
   | [...che/eventmesh/runtime/boot/AbstractHTTPServer.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2Jvb3QvQWJzdHJhY3RIVFRQU2VydmVyLmphdmE=) | `1.12% <0.00%> (-0.02%)` | :arrow_down: |
   | [...eventmesh/runtime/boot/AbstractRemotingServer.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2Jvb3QvQWJzdHJhY3RSZW1vdGluZ1NlcnZlci5qYXZh) | `4.54% <0.00%> (-0.59%)` | :arrow_down: |
   | [...he/eventmesh/runtime/boot/EventMeshHTTPServer.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2Jvb3QvRXZlbnRNZXNoSFRUUFNlcnZlci5qYXZh) | `0.53% <0.00%> (-0.02%)` | :arrow_down: |
   | [...eventmesh/runtime/boot/EventMeshHttpBootstrap.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2Jvb3QvRXZlbnRNZXNoSHR0cEJvb3RzdHJhcC5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...apache/eventmesh/runtime/boot/EventMeshServer.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2Jvb3QvRXZlbnRNZXNoU2VydmVyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...che/eventmesh/runtime/boot/EventMeshTCPServer.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2Jvb3QvRXZlbnRNZXNoVENQU2VydmVyLmphdmE=) | `0.56% <0.00%> (ø)` | |
   | [.../apache/eventmesh/runtime/common/ServiceState.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2NvbW1vbi9TZXJ2aWNlU3RhdGUuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...esh/runtime/core/consumer/SubscriptionManager.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2NvcmUvY29uc3VtZXIvU3Vic2NyaXB0aW9uTWFuYWdlci5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...core/protocol/grpc/consumer/EventMeshConsumer.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2NvcmUvcHJvdG9jb2wvZ3JwYy9jb25zdW1lci9FdmVudE1lc2hDb25zdW1lci5qYXZh) | `0.00% <0.00%> (ø)` | |
   | ... and [11 more](https://codecov.io/gh/apache/incubator-eventmesh/pull/3207?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mxsm commented on pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#issuecomment-1437206656

   @mytang0  After this PR is merged, I will submit a formatting PR to format the Java code in the project according to the eventmesh-code-style.xml code style.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mytang0 commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mytang0 (via GitHub)" <gi...@apache.org>.
mytang0 commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1112410164


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java:
##########
@@ -703,14 +720,15 @@ protected void initChannel(final SocketChannel channel) {
             if (sslContext != null && useTLS) {
                 final SSLEngine sslEngine = sslContext.createSSLEngine();
                 sslEngine.setUseClientMode(false);
-                pipeline.addFirst("ssl", new SslHandler(sslEngine));
+                pipeline.addFirst(getWorkerGroup(), "ssl", new SslHandler(sslEngine));

Review Comment:
   Thanks, I mean bossGroup and ioGroup pipelines need to add 'SslHandler'? You need to check the stage of SSL work, because when the old logic, you don't need to consider this issue.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mytang0 merged pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mytang0 (via GitHub)" <gi...@apache.org>.
mytang0 merged PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mytang0 commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mytang0 (via GitHub)" <gi...@apache.org>.
mytang0 commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1112670399


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java:
##########
@@ -116,118 +116,90 @@ public class EventMeshHTTPServer extends AbstractHTTPServer {
 
     public transient HTTPClientPool httpClientPool = new HTTPClientPool(10);
 
-    public EventMeshHTTPServer(final EventMeshServer eventMeshServer,
-                               final EventMeshHTTPConfiguration eventMeshHttpConfiguration) {
-        super(eventMeshHttpConfiguration.getHttpServerPort(),
-                eventMeshHttpConfiguration.isEventMeshServerUseTls(), eventMeshHttpConfiguration);
+    public EventMeshHTTPServer(final EventMeshServer eventMeshServer, final EventMeshHTTPConfiguration eventMeshHttpConfiguration) {
+
+        super(eventMeshHttpConfiguration.getHttpServerPort(), eventMeshHttpConfiguration.isEventMeshServerUseTls(), eventMeshHttpConfiguration);
         this.eventMeshServer = eventMeshServer;
         this.eventMeshHttpConfiguration = eventMeshHttpConfiguration;
         this.registry = eventMeshServer.getRegistry();
         this.acl = eventMeshServer.getAcl();
 
     }
 
-    public EventMeshServer getEventMeshServer() {
-        return eventMeshServer;
-    }
-
-
-    public void shutdownThreadPool() {
-        batchMsgExecutor.shutdown();
-        adminExecutor.shutdown();
-        clientManageExecutor.shutdown();
-        sendMsgExecutor.shutdown();
-        remoteMsgExecutor.shutdown();
-        pushMsgExecutor.shutdown();
-        replyMsgExecutor.shutdown();
-    }
-
     private void initThreadPool() {
 
         batchMsgExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerBatchMsgThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerBatchMsgThreadNum(),
-                new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerBatchBlockQSize()),
-                "eventMesh-batchMsg", true);
+            eventMeshHttpConfiguration.getEventMeshServerBatchMsgThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerBatchMsgThreadNum(),
+            new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerBatchBlockQSize()),
+            "eventMesh-batchMsg", true);
 
         sendMsgExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerSendMsgThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerSendMsgThreadNum(),
-                new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerSendMsgBlockQSize()),
-                "eventMesh-sendMsg", true);
+            eventMeshHttpConfiguration.getEventMeshServerSendMsgThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerSendMsgThreadNum(),
+            new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerSendMsgBlockQSize()),
+            "eventMesh-sendMsg", true);
 
         remoteMsgExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerRemoteMsgThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerRemoteMsgThreadNum(),
-                new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerRemoteMsgBlockQSize()),
-                "eventMesh-remoteMsg", true);
+            eventMeshHttpConfiguration.getEventMeshServerRemoteMsgThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerRemoteMsgThreadNum(),
+            new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerRemoteMsgBlockQSize()),
+            "eventMesh-remoteMsg", true);
 
         pushMsgExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerPushMsgThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerPushMsgThreadNum(),
-                new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerPushMsgBlockQSize()),
-                "eventMesh-pushMsg", true);
+            eventMeshHttpConfiguration.getEventMeshServerPushMsgThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerPushMsgThreadNum(),
+            new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerPushMsgBlockQSize()),
+            "eventMesh-pushMsg", true);
 
         clientManageExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerClientManageThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerClientManageThreadNum(),
-                new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerClientManageBlockQSize()),
-                "eventMesh-clientManage", true);
+            eventMeshHttpConfiguration.getEventMeshServerClientManageThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerClientManageThreadNum(),
+            new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerClientManageBlockQSize()),
+            "eventMesh-clientManage", true);
 
         adminExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerAdminThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerAdminThreadNum(),
-                new LinkedBlockingQueue<>(50), "eventMesh-admin",
-                true);
+            eventMeshHttpConfiguration.getEventMeshServerAdminThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerAdminThreadNum(),
+            new LinkedBlockingQueue<>(50), "eventMesh-admin",
+            true);
 
         replyMsgExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerReplyMsgThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerReplyMsgThreadNum(),
-                new LinkedBlockingQueue<>(100),
-                "eventMesh-replyMsg", true);
-    }
-
-    public ThreadPoolExecutor getBatchMsgExecutor() {
-        return batchMsgExecutor;
-    }
-
-    public ThreadPoolExecutor getSendMsgExecutor() {
-        return sendMsgExecutor;
-    }
-
-    public ThreadPoolExecutor getReplyMsgExecutor() {
-        return replyMsgExecutor;
+            eventMeshHttpConfiguration.getEventMeshServerReplyMsgThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerReplyMsgThreadNum(),
+            new LinkedBlockingQueue<>(100),
+            "eventMesh-replyMsg", true);
     }
 
-    public ThreadPoolExecutor getPushMsgExecutor() {
-        return pushMsgExecutor;
-    }
-
-    public ThreadPoolExecutor getClientManageExecutor() {
-        return clientManageExecutor;
-    }
-
-    public ThreadPoolExecutor getAdminExecutor() {
-        return adminExecutor;
-    }
-
-    public RateLimiter getMsgRateLimiter() {
-        return msgRateLimiter;
-    }
-
-    public RateLimiter getBatchRateLimiter() {
-        return batchRateLimiter;
-    }
-
-    public Registry getRegistry() {
-        return registry;
+    public void shutdownThreadPool() {
+        if (batchMsgExecutor != null) {
+            batchMsgExecutor.shutdown();
+        }
+        if (adminExecutor != null) {
+            adminExecutor.shutdown();
+        }
+        if (clientManageExecutor != null) {
+            clientManageExecutor.shutdown();
+        }
+        if (sendMsgExecutor != null) {
+            sendMsgExecutor.shutdown();
+        }
+        if (remoteMsgExecutor != null) {
+            remoteMsgExecutor.shutdown();
+        }
+        if (pushMsgExecutor != null) {
+            pushMsgExecutor.shutdown();
+        }
+        if (replyMsgExecutor != null) {
+            replyMsgExecutor.shutdown();
+        }
     }
 
     private void init() throws Exception {
         if (log.isInfoEnabled()) {
             log.info("==================EventMeshHTTPServer Initialing==================");
         }
-        super.init("eventMesh-http");
+        super.init("EventMesh-http");

Review Comment:
   eventMesh or EventMesh? Can be consistent.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mxsm commented on pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#issuecomment-1441916743

   @mytang0  I resolved the conflict and resbumit it


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mxsm commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1112680508


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java:
##########
@@ -116,118 +116,90 @@ public class EventMeshHTTPServer extends AbstractHTTPServer {
 
     public transient HTTPClientPool httpClientPool = new HTTPClientPool(10);
 
-    public EventMeshHTTPServer(final EventMeshServer eventMeshServer,
-                               final EventMeshHTTPConfiguration eventMeshHttpConfiguration) {
-        super(eventMeshHttpConfiguration.getHttpServerPort(),
-                eventMeshHttpConfiguration.isEventMeshServerUseTls(), eventMeshHttpConfiguration);
+    public EventMeshHTTPServer(final EventMeshServer eventMeshServer, final EventMeshHTTPConfiguration eventMeshHttpConfiguration) {
+
+        super(eventMeshHttpConfiguration.getHttpServerPort(), eventMeshHttpConfiguration.isEventMeshServerUseTls(), eventMeshHttpConfiguration);
         this.eventMeshServer = eventMeshServer;
         this.eventMeshHttpConfiguration = eventMeshHttpConfiguration;
         this.registry = eventMeshServer.getRegistry();
         this.acl = eventMeshServer.getAcl();
 
     }
 
-    public EventMeshServer getEventMeshServer() {
-        return eventMeshServer;
-    }
-
-
-    public void shutdownThreadPool() {
-        batchMsgExecutor.shutdown();
-        adminExecutor.shutdown();
-        clientManageExecutor.shutdown();
-        sendMsgExecutor.shutdown();
-        remoteMsgExecutor.shutdown();
-        pushMsgExecutor.shutdown();
-        replyMsgExecutor.shutdown();
-    }
-
     private void initThreadPool() {
 
         batchMsgExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerBatchMsgThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerBatchMsgThreadNum(),
-                new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerBatchBlockQSize()),
-                "eventMesh-batchMsg", true);
+            eventMeshHttpConfiguration.getEventMeshServerBatchMsgThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerBatchMsgThreadNum(),
+            new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerBatchBlockQSize()),
+            "eventMesh-batchMsg", true);
 
         sendMsgExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerSendMsgThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerSendMsgThreadNum(),
-                new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerSendMsgBlockQSize()),
-                "eventMesh-sendMsg", true);
+            eventMeshHttpConfiguration.getEventMeshServerSendMsgThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerSendMsgThreadNum(),
+            new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerSendMsgBlockQSize()),
+            "eventMesh-sendMsg", true);
 
         remoteMsgExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerRemoteMsgThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerRemoteMsgThreadNum(),
-                new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerRemoteMsgBlockQSize()),
-                "eventMesh-remoteMsg", true);
+            eventMeshHttpConfiguration.getEventMeshServerRemoteMsgThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerRemoteMsgThreadNum(),
+            new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerRemoteMsgBlockQSize()),
+            "eventMesh-remoteMsg", true);
 
         pushMsgExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerPushMsgThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerPushMsgThreadNum(),
-                new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerPushMsgBlockQSize()),
-                "eventMesh-pushMsg", true);
+            eventMeshHttpConfiguration.getEventMeshServerPushMsgThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerPushMsgThreadNum(),
+            new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerPushMsgBlockQSize()),
+            "eventMesh-pushMsg", true);
 
         clientManageExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerClientManageThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerClientManageThreadNum(),
-                new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerClientManageBlockQSize()),
-                "eventMesh-clientManage", true);
+            eventMeshHttpConfiguration.getEventMeshServerClientManageThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerClientManageThreadNum(),
+            new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerClientManageBlockQSize()),
+            "eventMesh-clientManage", true);
 
         adminExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerAdminThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerAdminThreadNum(),
-                new LinkedBlockingQueue<>(50), "eventMesh-admin",
-                true);
+            eventMeshHttpConfiguration.getEventMeshServerAdminThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerAdminThreadNum(),
+            new LinkedBlockingQueue<>(50), "eventMesh-admin",
+            true);
 
         replyMsgExecutor = ThreadPoolFactory.createThreadPoolExecutor(
-                eventMeshHttpConfiguration.getEventMeshServerReplyMsgThreadNum(),
-                eventMeshHttpConfiguration.getEventMeshServerReplyMsgThreadNum(),
-                new LinkedBlockingQueue<>(100),
-                "eventMesh-replyMsg", true);
-    }
-
-    public ThreadPoolExecutor getBatchMsgExecutor() {
-        return batchMsgExecutor;
-    }
-
-    public ThreadPoolExecutor getSendMsgExecutor() {
-        return sendMsgExecutor;
-    }
-
-    public ThreadPoolExecutor getReplyMsgExecutor() {
-        return replyMsgExecutor;
+            eventMeshHttpConfiguration.getEventMeshServerReplyMsgThreadNum(),
+            eventMeshHttpConfiguration.getEventMeshServerReplyMsgThreadNum(),
+            new LinkedBlockingQueue<>(100),
+            "eventMesh-replyMsg", true);
     }
 
-    public ThreadPoolExecutor getPushMsgExecutor() {
-        return pushMsgExecutor;
-    }
-
-    public ThreadPoolExecutor getClientManageExecutor() {
-        return clientManageExecutor;
-    }
-
-    public ThreadPoolExecutor getAdminExecutor() {
-        return adminExecutor;
-    }
-
-    public RateLimiter getMsgRateLimiter() {
-        return msgRateLimiter;
-    }
-
-    public RateLimiter getBatchRateLimiter() {
-        return batchRateLimiter;
-    }
-
-    public Registry getRegistry() {
-        return registry;
+    public void shutdownThreadPool() {
+        if (batchMsgExecutor != null) {
+            batchMsgExecutor.shutdown();
+        }
+        if (adminExecutor != null) {
+            adminExecutor.shutdown();
+        }
+        if (clientManageExecutor != null) {
+            clientManageExecutor.shutdown();
+        }
+        if (sendMsgExecutor != null) {
+            sendMsgExecutor.shutdown();
+        }
+        if (remoteMsgExecutor != null) {
+            remoteMsgExecutor.shutdown();
+        }
+        if (pushMsgExecutor != null) {
+            pushMsgExecutor.shutdown();
+        }
+        if (replyMsgExecutor != null) {
+            replyMsgExecutor.shutdown();
+        }
     }
 
     private void init() throws Exception {
         if (log.isInfoEnabled()) {
             log.info("==================EventMeshHTTPServer Initialing==================");
         }
-        super.init("eventMesh-http");
+        super.init("EventMesh-http");

Review Comment:
   get it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mytang0 commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mytang0 (via GitHub)" <gi...@apache.org>.
mytang0 commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1111828270


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/SystemUtils.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.common.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+
+public abstract class SystemUtils {
+
+    public static final String OS_NAME = System.getProperty("os.name");
+
+    private static boolean isLinuxPlatform = false;
+
+    private static boolean isWindowsPlatform = false;
+
+    static {
+        if (OS_NAME != null && OS_NAME.toLowerCase().contains("linux")) {
+            isLinuxPlatform = true;
+        }
+
+        if (OS_NAME != null && OS_NAME.toLowerCase().contains("windows")) {
+            isWindowsPlatform = true;
+        }
+    }
+
+    private SystemUtils() {
+
+    }
+
+    public static boolean isLinuxPlatform() {
+        return isLinuxPlatform;
+    }
+
+    public static boolean isWindowsPlatform() {
+        return isWindowsPlatform;
+    }
+
+    public static String getProcessId() {
+        try {
+            String name = ManagementFactory.getRuntimeMXBean().getName();
+            return name.split("@")[0];
+        } catch (final Exception ex) {
+            try {
+                // try a Linux-specific way
+                return new File("/proc/self").getCanonicalFile().getName();
+            } catch (final IOException ignoredUseDefault) {
+                // Ignore exception.
+            }
+        }
+        return "-1";
+    }
+}

Review Comment:
   Is it possible to consider a full reference to ProcessIdUtil.getProcessId



##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java:
##########
@@ -703,14 +720,15 @@ protected void initChannel(final SocketChannel channel) {
             if (sslContext != null && useTLS) {
                 final SSLEngine sslEngine = sslContext.createSSLEngine();
                 sslEngine.setUseClientMode(false);
-                pipeline.addFirst("ssl", new SslHandler(sslEngine));
+                pipeline.addFirst(getWorkerGroup(), "ssl", new SslHandler(sslEngine));

Review Comment:
   Why only apply to workerGroup?



##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java:
##########
@@ -121,7 +124,7 @@ public abstract class AbstractHTTPServer extends AbstractRemotingServer {
     private final transient EventMeshHTTPConfiguration eventMeshHttpConfiguration;
 
     private final transient ThreadPoolExecutor asyncContextCompleteHandler =
-            ThreadPoolFactory.createThreadPoolExecutor(10, 10, "EventMesh-http-asyncContext");
+        ThreadPoolFactory.createThreadPoolExecutor(10, 10, "EventMesh-http-asyncContext");

Review Comment:
   Would you like to open an issue to modify the code style?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mxsm commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1111921301


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java:
##########
@@ -121,7 +124,7 @@ public abstract class AbstractHTTPServer extends AbstractRemotingServer {
     private final transient EventMeshHTTPConfiguration eventMeshHttpConfiguration;
 
     private final transient ThreadPoolExecutor asyncContextCompleteHandler =
-            ThreadPoolFactory.createThreadPoolExecutor(10, 10, "EventMesh-http-asyncContext");
+        ThreadPoolFactory.createThreadPoolExecutor(10, 10, "EventMesh-http-asyncContext");

Review Comment:
   > Would you like to open an issue to modify the code style?
   
   @mytang0  I will create issue to modify the code style base on eventmesh-code-style.xml



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mytang0 commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mytang0 (via GitHub)" <gi...@apache.org>.
mytang0 commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1112410164


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java:
##########
@@ -703,14 +720,15 @@ protected void initChannel(final SocketChannel channel) {
             if (sslContext != null && useTLS) {
                 final SSLEngine sslEngine = sslContext.createSSLEngine();
                 sslEngine.setUseClientMode(false);
-                pipeline.addFirst("ssl", new SslHandler(sslEngine));
+                pipeline.addFirst(getWorkerGroup(), "ssl", new SslHandler(sslEngine));

Review Comment:
   Thanks, I mean bossGroup and ioGroup pipelines need to add 'SslHandler'? You need to check the stage of SSL work, because when the old logic shares the group, you don't need to consider this issue.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mytang0 commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mytang0 (via GitHub)" <gi...@apache.org>.
mytang0 commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1112410164


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java:
##########
@@ -703,14 +720,15 @@ protected void initChannel(final SocketChannel channel) {
             if (sslContext != null && useTLS) {
                 final SSLEngine sslEngine = sslContext.createSSLEngine();
                 sslEngine.setUseClientMode(false);
-                pipeline.addFirst("ssl", new SslHandler(sslEngine));
+                pipeline.addFirst(getWorkerGroup(), "ssl", new SslHandler(sslEngine));

Review Comment:
   Thanks, I mean bossGroup and ioGroup pipeline whether need to add 'SslHandler'. Need to look at the stages where SSL works.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mxsm commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1112631156


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java:
##########
@@ -703,14 +720,15 @@ protected void initChannel(final SocketChannel channel) {
             if (sslContext != null && useTLS) {
                 final SSLEngine sslEngine = sslContext.createSSLEngine();
                 sslEngine.setUseClientMode(false);
-                pipeline.addFirst("ssl", new SslHandler(sslEngine));
+                pipeline.addFirst(getWorkerGroup(), "ssl", new SslHandler(sslEngine));

Review Comment:
   > Thanks, I mean bossGroup and ioGroup pipelines need to add 'SslHandler'? You need to check the stage of SSL work, because when the old logic, you don't need to consider this issue.
   
   @mytang0  The bossGroup and ioGroup pipelines do not need to add 'SslHandler' because data processing is performed in the workerGroup, and the SslHandler is only used when data is involved.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mytang0 commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mytang0 (via GitHub)" <gi...@apache.org>.
mytang0 commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1111859213


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java:
##########
@@ -121,7 +124,7 @@ public abstract class AbstractHTTPServer extends AbstractRemotingServer {
     private final transient EventMeshHTTPConfiguration eventMeshHttpConfiguration;
 
     private final transient ThreadPoolExecutor asyncContextCompleteHandler =
-            ThreadPoolFactory.createThreadPoolExecutor(10, 10, "EventMesh-http-asyncContext");
+        ThreadPoolFactory.createThreadPoolExecutor(10, 10, "EventMesh-http-asyncContext");

Review Comment:
   I noticed that there are a lot of style modifications.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mxsm commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1111926568


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/SystemUtils.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.common.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+
+public abstract class SystemUtils {
+
+    public static final String OS_NAME = System.getProperty("os.name");
+
+    private static boolean isLinuxPlatform = false;
+
+    private static boolean isWindowsPlatform = false;
+
+    static {
+        if (OS_NAME != null && OS_NAME.toLowerCase().contains("linux")) {
+            isLinuxPlatform = true;
+        }
+
+        if (OS_NAME != null && OS_NAME.toLowerCase().contains("windows")) {
+            isWindowsPlatform = true;
+        }
+    }
+
+    private SystemUtils() {
+
+    }
+
+    public static boolean isLinuxPlatform() {
+        return isLinuxPlatform;
+    }
+
+    public static boolean isWindowsPlatform() {
+        return isWindowsPlatform;
+    }
+
+    public static String getProcessId() {
+        try {
+            String name = ManagementFactory.getRuntimeMXBean().getName();
+            return name.split("@")[0];
+        } catch (final Exception ex) {
+            try {
+                // try a Linux-specific way
+                return new File("/proc/self").getCanonicalFile().getName();
+            } catch (final IOException ignoredUseDefault) {
+                // Ignore exception.
+            }
+        }
+        return "-1";
+    }
+}

Review Comment:
   > Is it possible to consider a full reference to ProcessIdUtil.getProcessId
   
   My consideration at that time was that the situation of running on the Android system was extremely rare, so I used this simple mode. Let me paste the full code snippet here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mytang0 commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mytang0 (via GitHub)" <gi...@apache.org>.
mytang0 commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1112410164


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java:
##########
@@ -703,14 +720,15 @@ protected void initChannel(final SocketChannel channel) {
             if (sslContext != null && useTLS) {
                 final SSLEngine sslEngine = sslContext.createSSLEngine();
                 sslEngine.setUseClientMode(false);
-                pipeline.addFirst("ssl", new SslHandler(sslEngine));
+                pipeline.addFirst(getWorkerGroup(), "ssl", new SslHandler(sslEngine));

Review Comment:
   Thanks, I mean bossGroup and ioGroup pipeline whether need to add 'SslHandler'



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mytang0 commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mytang0 (via GitHub)" <gi...@apache.org>.
mytang0 commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1112412140


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java:
##########
@@ -121,7 +124,7 @@ public abstract class AbstractHTTPServer extends AbstractRemotingServer {
     private final transient EventMeshHTTPConfiguration eventMeshHttpConfiguration;
 
     private final transient ThreadPoolExecutor asyncContextCompleteHandler =
-            ThreadPoolFactory.createThreadPoolExecutor(10, 10, "EventMesh-http-asyncContext");
+        ThreadPoolFactory.createThreadPoolExecutor(10, 10, "EventMesh-http-asyncContext");

Review Comment:
   Thanks, great.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mytang0 commented on pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mytang0 (via GitHub)" <gi...@apache.org>.
mytang0 commented on PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#issuecomment-1437705321

   > @mytang0 After this PR is merged, I will submit a formatting PR to format the Java code in the project according to the eventmesh-code-style.xml code style.
   
   Ok.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mxsm commented on pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#issuecomment-1438003147

   @mytang0  I have resubmitted this pr, PTAL~


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mxsm commented on a diff in pull request #3207: [ISSUE #3201]Optimize remote service related code

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #3207:
URL: https://github.com/apache/incubator-eventmesh/pull/3207#discussion_r1111999259


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java:
##########
@@ -703,14 +720,15 @@ protected void initChannel(final SocketChannel channel) {
             if (sslContext != null && useTLS) {
                 final SSLEngine sslEngine = sslContext.createSSLEngine();
                 sslEngine.setUseClientMode(false);
-                pipeline.addFirst("ssl", new SslHandler(sslEngine));
+                pipeline.addFirst(getWorkerGroup(), "ssl", new SslHandler(sslEngine));

Review Comment:
   - The bossGroup is used to listen and poll Accept requests
   
   - The ioGroup is mainly used to listen for READ and WRITE events. It handles channels registered by the Boss Group.
   
   - The workGroup is used to execute  ChannelHandlers
   
   All ChannelHandlers can be executed using a single thread pool without the need for separate thread pools, but in this case, the business processing is handled using a separate thread pool.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org