[hornetq-commits] JBoss hornetq SVN: r12214 - trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Feb 28 11:44:07 EST 2012


Author: borges
Date: 2012-02-28 11:44:06 -0500 (Tue, 28 Feb 2012)
New Revision: 12214

Modified:
   trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
Log:
threadPool gets shutdownNow() after time-out.

Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java	2012-02-28 16:43:48 UTC (rev 12213)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java	2012-02-28 16:44:06 UTC (rev 12214)
@@ -612,21 +612,18 @@
             postOffice.stop();
          }
 
+
             if (scheduledPool != null)
             {
-               List<Runnable> tasks = scheduledPool.shutdownNow();
-               for (Runnable task : tasks)
+               // we just interrupt all running tasks, these are supposed to be pings and the like.
+               scheduledPool.shutdownNow();
+            }
+
+            if (memoryManager != null)
             {
-                  HornetQServerImpl.log.info(this + "::Waiting for " + task);
+               memoryManager.stop();
             }
-            }
 
-         if (memoryManager != null)
-         {
-            memoryManager.stop();
-         }
-
-
             if (threadPool != null)
             {
                threadPool.shutdown();
@@ -634,29 +631,24 @@
                {
                   if (!threadPool.awaitTermination(10, TimeUnit.SECONDS))
                   {
-                     HornetQServerImpl.log.warn("Timed out waiting for pool to terminate");
+                     HornetQServerImpl.log.warn("Timed out waiting for pool to terminate " + threadPool +
+                              ". Interrupting all its threads!");
+                     for (Runnable r : threadPool.shutdownNow())
+                     {
+                        log.debug("Cancelled the execution of " + r);
+                     }
                   }
                }
                catch (InterruptedException e)
                {
                   // Ignore
                }
-               threadPool = null;
             }
 
-          try
-         {
-            if (!scheduledPool.awaitTermination(10, TimeUnit.SECONDS))
-            {
-               HornetQServerImpl.log.warn("Timed out waiting for scheduled pool to terminate");
-            }
-         }
-         catch (InterruptedException e)
-         {
-            // Ignore
-         }
+            scheduledPool = null;
+            threadPool = null;
 
-         securityStore.stop();
+            securityStore.stop();
 
          threadPool = null;
 



More information about the hornetq-commits mailing list