[jboss-cvs] JBossAS SVN: r63944 - 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
Tue Jul 10 11:58:24 EDT 2007
Author: adrian at jboss.org
Date: 2007-07-10 11:58:24 -0400 (Tue, 10 Jul 2007)
New Revision: 63944
Modified:
branches/Branch_4_2/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java
Log:
[JBAS-4525] [JBAS-4526] - Periodically do a check for stop in the UIL2 WriteTask,
add some extra error handling to cover potential failures in thread creation.
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-10 15:43:32 UTC (rev 63943)
+++ branches/Branch_4_2/messaging/src/main/org/jboss/mq/il/uil2/SocketManager.java 2007-07-10 15:58:24 UTC (rev 63944)
@@ -142,8 +142,30 @@
running.set(true);
}
- readThread.start();
- writeThread.start();
+ try
+ {
+ readThread.start();
+ writeThread.start();
+ }
+ catch (Throwable t)
+ {
+ try
+ {
+ stop();
+ }
+ catch (Throwable ignored)
+ {
+ }
+
+ try
+ {
+ socket.close();
+ }
+ catch (Throwable ignored)
+ {
+ }
+ log.warn("Error starting socket manager threads", t);
+ }
}
/** Stop the read and write threads by interrupting them.
@@ -513,9 +535,17 @@
while (true)
{
BaseMsg msg = null;
+
+ synchronized (running)
+ {
+ if (writeState != STARTED)
+ break;
+ }
try
{
- msg = (BaseMsg) sendQueue.take();
+ msg = (BaseMsg) sendQueue.poll(10000l);
+ if (msg == null)
+ continue; // Check for stop if no message for 10 seconds
if (trace)
log.trace("Write msg: " + msg);
msg.write(out);
More information about the jboss-cvs-commits
mailing list