clebertsuconic commented on a change in pull request #2558: ARTEMIS-2257 Race 
condition when calling shutdownGracefully in SharedEventLoopGroup
URL: https://github.com/apache/activemq-artemis/pull/2558#discussion_r265195488
 
 

 ##########
 File path: 
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedEventLoopGroup.java
 ##########
 @@ -84,30 +84,32 @@ public ThreadFactory run() {
 
    @Override
    public Future<?> shutdownGracefully(final long l, final long l2, final 
TimeUnit timeUnit) {
-      if (channelFactoryCount.decrementAndGet() == 0) {
-         shutdown.compareAndSet(null, next().scheduleAtFixedRate(new 
Runnable() {
-            @Override
-            public void run() {
-               synchronized (SharedEventLoopGroup.class) {
-                  if (shutdown.get() != null) {
-                     Future<?> future = 
SharedEventLoopGroup.super.shutdownGracefully(l, l2, timeUnit);
-                     future.addListener(new FutureListener<Object>() {
-                        @Override
-                        public void operationComplete(Future<Object> future) 
throws Exception {
-                           if (future.isSuccess()) {
-                              terminationPromise.setSuccess(null);
-                           } else {
-                              terminationPromise.setFailure(future.cause());
+      synchronized (SharedEventLoopGroup.class) {
 
 Review comment:
   if you applied the synchronize here to this instead of .class I would be ok 
with merging this without a test. 
   
   A synchornize on a .class here.. without a test.. I don't know what 
implications it would have.
   
   Can you tell me why the synchornize on the class was needed?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to