dev@shoal.java.net

About Shoal Issue #26("Thread don't shutdown")

From: Bongjae Chang <carryel_at_korea.com>
Date: Wed, 12 Aug 2009 17:22:44 +0900

Hi,

Today, I also saw Shoal Issue #26' problem.

When I reviewed codes of the shutdown logic, I could know that the shutdown logic was not complete.

Actually it seems that maybe the patch is in progress.

So I added more logics like the following experimentally.

---------------
Index: com/sun/enterprise/ee/cms/impl/common/Router.java
===================================================================
RCS file: /cvs/shoal/gms/src/java/com/sun/enterprise/ee/cms/impl/common/Router.java,v
retrieving revision 1.14
diff -c -w -r1.14 Router.java
*** com/sun/enterprise/ee/cms/impl/common/Router.java 8 Jul 2009 15:23:07 -0000 1.14
--- com/sun/enterprise/ee/cms/impl/common/Router.java 12 Aug 2009 08:15:39 -0000
***************
*** 547,552 ****
--- 547,569 ----
          return failureRecoveryAF.keySet();
      }
  
+ public void shutdown() {
+ if( signalHandlerThread != null )
+ signalHandlerThread.interrupt();
+ if( queue != null )
+ queue.clear();
+ if( actionPool != null )
+ actionPool.shutdownNow();
+ failureNotificationAF.clear();
+ failureRecoveryAF.clear();
+ messageAF.clear();
+ plannedShutdownAF.clear();
+ joinNotificationAF.clear();
+ joinedAndReadyNotificationAF.clear();
+ failureSuspectedAF.clear();
+ groupLeadershipNotificationAFs.clear();
+ }
+
      /**
       * implements Callable. Used for handing off the job of calling the Action's
       * consumeSignal() method to a ThreadPool.
Index: com/sun/enterprise/ee/cms/impl/jxta/GMSContext.java
===================================================================
RCS file: /cvs/shoal/gms/src/java/com/sun/enterprise/ee/cms/impl/jxta/GMSContext.java,v
retrieving revision 1.25
diff -c -w -r1.25 GMSContext.java
*** com/sun/enterprise/ee/cms/impl/jxta/GMSContext.java 30 Jul 2009 18:15:46 -0000 1.25
--- com/sun/enterprise/ee/cms/impl/jxta/GMSContext.java 12 Aug 2009 08:03:06 -0000
***************
*** 158,163 ****
--- 158,170 ----
              logger.log(Level.INFO, "shutdown.instanceshutdown", new Object[] {groupName});
              groupCommunicationProvider.leave(false);
          }
+ shuttingDown = true;
+ if( viewWindowThread != null )
+ viewWindowThread.interrupt();
+ if( messageWindowThread != null )
+ messageWindowThread.interrupt();
+ if( router != null )
+ router.shutdown();
      }
  
      public long getStartTime() {
---------------

When I tested it, I could see all thread exited completely and the process exited normally.

Could you please review this?

And if I am missing some points, please let me know.

Thanks!

PS) I attached the proposed patch.

--
Bongjae Chang