[jboss-cvs] JBossAS SVN: r97306 - branches/JBoss_4_0_5_GA_CP18_ASPATCH-444/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:37:13 EST 2009
Author: jiwils
Date: 2009-12-02 11:37:13 -0500 (Wed, 02 Dec 2009)
New Revision: 97306
Modified:
branches/JBoss_4_0_5_GA_CP18_ASPATCH-444/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java
Log:
Ported (from CP17 patch) fix for ASPATCH-444 on 4.0.5_CP18.
Modified: branches/JBoss_4_0_5_GA_CP18_ASPATCH-444/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP18_ASPATCH-444/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java 2009-12-02 16:13:58 UTC (rev 97305)
+++ branches/JBoss_4_0_5_GA_CP18_ASPATCH-444/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java 2009-12-02 16:37:13 UTC (rev 97306)
@@ -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