[jboss-cvs] JBossAS SVN: r97300 - branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 2 11:06:04 EST 2009


Author: jiwils
Date: 2009-12-02 11:06:03 -0500 (Wed, 02 Dec 2009)
New Revision: 97300

Modified:
   branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java
Log:
Merged the fix for ASPATCH-444 into the CP branch for 4.0.5.

Modified: branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java	2009-12-02 16:05:02 UTC (rev 97299)
+++ branches/JBoss_4_0_5_GA_CP/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java	2009-12-02 16:06:03 UTC (rev 97300)
@@ -172,25 +172,34 @@
     */
    public void stop()
    {
-      synchronized (running)
-      {
-         if (readState == STARTED)
-         {
-            readState = STOPPING;
-            readThread.interrupt();
-         }
-         if (writeState == STARTED)
-         {
-            writeState = STOPPING;
-            writeThread.interrupt();
-         }
-         running.set(false);
-         if (pool != null)
-         {
-            pool.shutdownNow();
-            pool = null;
-         }
-      }
+	   synchronized (running)
+	   {
+		   if (trace)
+			   log.trace("stop() " + readThread + " " + writeThread);
+		   if (readState == STARTED)
+		   {
+			   readState = STOPPING;
+			   readThread.interrupt();
+		   }
+		   if (writeState == STARTED)
+		   {
+			   writeState = STOPPING;
+			   writeThread.interrupt();
+		   }
+		   running.set(false);
+		   if (pool != null)
+		   {
+			   pool.shutdownNow();
+			   pool = null;
+		   }
+		   try
+		   {
+			   socket.close();
+		   }
+		   catch (Throwable ignored)
+		   {
+		   }
+	   } 
    }
 
    /** Set the callback handler for msgs that were not originated by the
@@ -318,7 +327,7 @@
       public void run()
       {
          int msgType = 0;
-         log.debug("Begin ReadTask.run");
+         log.debug("Begin ReadTask.run" + Thread.currentThread());
          try
          {
             bufferedInput = new NotifyingBufferedInputStream(socket.getInputStream(), bufferSize, chunkSize, handler);
@@ -404,7 +413,7 @@
                break;
             }
          }
-         log.debug("End ReadTask.run");
+         log.debug("End ReadTask.run" + Thread.currentThread());
       }
 
       /**
@@ -418,7 +427,7 @@
          }
          catch (Throwable e)
          {
-            if (e instanceof JMSException)
+            if (e instanceof JMSException || running.get() == false)
                log.trace("Failed to handle: " + msg.toString(), e);
             else if (e instanceof RuntimeException || e instanceof Error)
                log.error("Failed to handle: " + msg.toString(), e);
@@ -431,7 +440,10 @@
             }
             catch (Exception ie)
             {
-               log.debug("Failed to send error reply", ie);
+            	if (running.get())
+            		log.debug("Failed to send error reply", ie);
+            	else
+            		log.trace("Failed to send error reply", ie); 
             }
          }
       }
@@ -518,7 +530,7 @@
    {
       public void run()
       {
-         log.debug("Begin WriteTask.run");
+         log.debug("Begin WriteTask.run" + Thread.currentThread());
          try
          {
             bufferedOutput =
@@ -568,7 +580,7 @@
                break;
             }
          }
-         log.debug("End WriteTask.run");
+         log.debug("End WriteTask.run" + Thread.currentThread());
       }
 
       /**




More information about the jboss-cvs-commits mailing list