[jboss-cvs] JBossAS SVN: r64066 - branches/Branch_4_2/messaging/src/main/org/jboss/mq/il/uil2.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 16 09:34:26 EDT 2007
Author: adrian at jboss.org
Date: 2007-07-16 09:34:26 -0400 (Mon, 16 Jul 2007)
New Revision: 64066
Modified:
branches/Branch_4_2/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java
Log:
[JBAS-4555] - Close the socket during stop() instead of relying on Thread.interrupt()
Modified: branches/Branch_4_2/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java
===================================================================
--- branches/Branch_4_2/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java 2007-07-16 11:34:15 UTC (rev 64065)
+++ branches/Branch_4_2/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java 2007-07-16 13:34:26 UTC (rev 64066)
@@ -157,13 +157,6 @@
{
}
- try
- {
- socket.close();
- }
- catch (Throwable ignored)
- {
- }
log.warn("Error starting socket manager threads", t);
}
}
@@ -174,6 +167,8 @@
{
synchronized (running)
{
+ if (trace)
+ log.trace("stop() " + readThread + " " + writeThread);
if (readState == STARTED)
{
readState = STOPPING;
@@ -190,6 +185,13 @@
pool.shutdownNow();
pool = null;
}
+ try
+ {
+ socket.close();
+ }
+ catch (Throwable ignored)
+ {
+ }
}
}
@@ -318,7 +320,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 +406,7 @@
break;
}
}
- log.debug("End ReadTask.run");
+ log.debug("End ReadTask.run " + Thread.currentThread());
}
/**
@@ -418,7 +420,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 +433,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 +523,7 @@
{
public void run()
{
- log.debug("Begin WriteTask.run");
+ log.debug("Begin WriteTask.run " + Thread.currentThread());
try
{
bufferedOutput =
@@ -568,7 +573,7 @@
break;
}
}
- log.debug("End WriteTask.run");
+ log.debug("End WriteTask.run " + Thread.currentThread());
}
/**
More information about the jboss-cvs-commits
mailing list