You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "zrlw (via GitHub)" <gi...@apache.org> on 2025/03/03 11:20:55 UTC

[I] [Bug] NamedThreadFactory might be optimized by removing redundant field mGroup [dubbo]

zrlw opened a new issue, #15201:
URL: https://github.com/apache/dubbo/issues/15201

   ### Pre-check
   
   - [x] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Apache Dubbo Component
   
   Java SDK (apache/dubbo)
   
   ### Dubbo Version
   
   Dubbo 3.3
   
   ### Steps to reproduce this issue
   
   1. it's unnecessary that getting thread group by NamedThreadFactory, because the thread group could be determined by Thread#init:
   ```
   private void init(ThreadGroup g, Runnable target, String name,
                         long stackSize, AccessControlContext acc,
                         boolean inheritThreadLocals) {
           if (name == null) {
               throw new NullPointerException("name cannot be null");
           }
   
           this.name = name;
   
           Thread parent = currentThread();
           SecurityManager security = System.getSecurityManager();
           if (g == null) {
               /* Determine if it's an applet or not */
   
               /* If there is a security manager, ask the security manager
                  what to do. */
               if (security != null) {
                   g = security.getThreadGroup();
               }
   
               /* If the security doesn't have a strong opinion of the matter
                  use the parent thread group. */
               if (g == null) {
                   g = parent.getThreadGroup();
               }
           }
   ```
   ```System.getSecurityManager()``` should not be called by NamedThreadFactory again, ```The heart of the Security Manager is a complex access-control algorithm which often imposes an unacceptable performance penalty```  and  ```System::getSecurityManager always to return null``` after Java 18.
   https://bugs.openjdk.org/browse/JDK-8264713
   2. sometimes EagerThreadPoolExecutorTest.testEagerThreadPoolFast might failed because of awaitting EagerThreadPoolExecutor timeout,
   https://github.com/apache/dubbo/actions/runs/13624514963/job/38079718397
   
   ### What you expected to happen
   
   the time elapsed of EagerThreadPoolExecutorTest shoule be less than 3 seconds.
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [x] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: notifications-unsubscribe@dubbo.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] NamedThreadFactory might be optimized by removing redundant field mGroup [dubbo]

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ closed issue #15201: [Bug] NamedThreadFactory might be optimized by removing redundant field mGroup
URL: https://github.com/apache/dubbo/issues/15201


-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org