Author: borges
Date: 2011-07-22 09:58:06 -0400 (Fri, 22 Jul 2011)
New Revision: 11024
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
Log:
Make sure both executors receive a shutdown request.
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-07-22
13:57:33 UTC (rev 11023)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-07-22
13:58:06 UTC (rev 11024)
@@ -176,13 +176,19 @@
public static synchronized void clearThreadPools()
{
-
if (globalThreadPool != null)
{
globalThreadPool.shutdown();
+ }
+ if (globalScheduledThreadPool != null)
+ {
+ globalScheduledThreadPool.shutdown();
+ }
+ try
+ {
try
{
- if (!globalThreadPool.awaitTermination(10, TimeUnit.SECONDS))
+ if (globalThreadPool != null &&
!globalThreadPool.awaitTermination(10, TimeUnit.SECONDS))
{
throw new IllegalStateException("Couldn't finish the
globalThreadPool");
}
@@ -190,30 +196,23 @@
catch (InterruptedException e)
{
}
- finally
- {
- globalThreadPool = null;
- }
- }
-
- if (globalScheduledThreadPool != null)
- {
- globalScheduledThreadPool.shutdown();
try
{
- if (!globalScheduledThreadPool.awaitTermination(10, TimeUnit.SECONDS))
+ if (globalScheduledThreadPool != null &&
!globalScheduledThreadPool.awaitTermination(10, TimeUnit.SECONDS))
{
throw new IllegalStateException("Couldn't finish the
globalScheduledThreadPool");
}
}
+
catch (InterruptedException e)
{
}
- finally
- {
- globalScheduledThreadPool = null;
- }
}
+ finally
+ {
+ globalThreadPool = null;
+ globalScheduledThreadPool = null;
+ }
}
private static synchronized ExecutorService getGlobalThreadPool()
Show replies by date