YongGoose commented on issue #6774:
URL: 
https://github.com/apache/incubator-seata/issues/6774#issuecomment-2676706690

   @funky-eyes 
   
   I have created a draft PR with a question.  
   
   > Yes, for example, in NettyClientBootstrap, we can build a shared 
eventLoop. When the configuration for the shared eventLoop is set to true, it 
will create and use the shared eventLoop. If it is set to false, the original 
logic will be maintained.
   
   As mentioned in the comments, I have implemented `NettyClientBootstrap` to 
create a shared `eventLoop` based on the configuration.  
   
   In this case, I am wondering if the shared `eventLoop` should be `static`.  
   
   If it is `static`, it will be shared across classes, allowing multiple 
instances of `NettyClientBootstrap` to use the same `eventLoop`. However, if it 
is not shared, creating a new `eventLoop` will also change the `eventLoop` of 
previously created `NettyClientBootstrap` instances.
   
   ---
   
   In the test below, if `eventLoop` is `static`, it remains the `same` even 
when `getEnableClientSharedEventLoop`'s return value is `false`.
   
   ```
       @Test
       void testSharedEventLoopGroupDisabled() {
           
when(nettyClientConfig.getEnableClientSharedEventLoop()).thenReturn(false);
           NettyClientBootstrap tmBootstrap = new 
NettyClientBootstrap(nettyClientConfig, eventExecutorGroup, 
NettyPoolKey.TransactionRole.TMROLE);
           NettyClientBootstrap rmBootstrap = new 
NettyClientBootstrap(nettyClientConfig, eventExecutorGroup, 
NettyPoolKey.TransactionRole.RMROLE);
   
           EventLoopGroup tmSharedEventLoopGroup = 
getSharedEventLoopGroup(tmBootstrap);
           EventLoopGroup rmSharedEventLoopGroup = 
getSharedEventLoopGroup(rmBootstrap);
           Assertions.assertNotSame(tmSharedEventLoopGroup, 
rmSharedEventLoopGroup, "EventLoopGroup should not be shared");
       }
   ```


-- 
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-unsubscr...@seata.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to