[jboss-cvs] JBoss Messaging SVN: r7196 - in branches/Branch_1_4/src/main/org/jboss: messaging/core/impl/postoffice and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jun 4 07:33:41 EDT 2009
Author: gaohoward
Date: 2009-06-04 07:33:41 -0400 (Thu, 04 Jun 2009)
New Revision: 7196
Modified:
branches/Branch_1_4/src/main/org/jboss/jms/server/remoting/JMSServerInvocationHandler.java
branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
Log:
JBMESSAGING-1637
interruption handling issue
Modified: branches/Branch_1_4/src/main/org/jboss/jms/server/remoting/JMSServerInvocationHandler.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/jms/server/remoting/JMSServerInvocationHandler.java 2009-06-04 07:04:54 UTC (rev 7195)
+++ branches/Branch_1_4/src/main/org/jboss/jms/server/remoting/JMSServerInvocationHandler.java 2009-06-04 11:33:41 UTC (rev 7196)
@@ -78,6 +78,8 @@
}
catch (InterruptedException e)
{
+ // TODO - this is *incorrect* interrupt handling. The exception should either be rethrown or
+ //the interrupt flag should be reset.
log.error("Failed to set closed to " + closed, e);
}
}
@@ -125,7 +127,19 @@
{
if (trace) { log.trace("invoking " + invocation); }
- invokeLock.readLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ invokeLock.readLock().acquire();
+ break;
+ }
+ catch (InterruptedException e)
+ {
+ intr = true;
+ }
+ }
try
{
if (closed)
@@ -145,6 +159,7 @@
finally
{
invokeLock.readLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
}
Modified: branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2009-06-04 07:04:54 UTC (rev 7195)
+++ branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2009-06-04 11:33:41 UTC (rev 7196)
@@ -527,7 +527,19 @@
throw new IllegalArgumentException("Cannot request clustered queues on non clustered post office");
}
- lock.readLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.readLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
try
{
@@ -561,6 +573,7 @@
finally
{
lock.readLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
}
@@ -571,7 +584,19 @@
throw new IllegalArgumentException("Queue name is null");
}
- lock.readLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.readLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
try
{
@@ -589,12 +614,25 @@
finally
{
lock.readLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
}
public Binding getBindingForChannelID(long channelID) throws Exception
{
- lock.readLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.readLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
try
{
@@ -605,6 +643,7 @@
finally
{
lock.readLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
}
@@ -842,7 +881,19 @@
{
List list = new ArrayList();
- lock.readLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.readLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
try
{
@@ -888,6 +939,7 @@
finally
{
lock.readLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
//Need to copy
@@ -1373,7 +1425,19 @@
{
if (trace) { log.trace(this + " handleAckAllDeliveries " + nodeID); }
- lock.readLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.readLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
try
{
@@ -1392,6 +1456,7 @@
finally
{
lock.readLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
}
@@ -1399,7 +1464,19 @@
{
if (trace) { log.trace(this + " handleAddAllReplicatedDeliveries " + nodeID); }
- lock.readLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.readLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
try
{
@@ -1435,6 +1512,8 @@
finally
{
lock.readLock().release();
+ if (intr) Thread.currentThread().interrupt();
+
}
}
@@ -1791,7 +1870,19 @@
unboundAll = true;
- lock.readLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.readLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
try
{
@@ -1827,6 +1918,7 @@
finally
{
lock.readLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
if ((bind && !boundAll) || (!bind && !unboundAll))
@@ -2054,7 +2146,19 @@
private Collection getBindings(String queueName) throws Exception
{
- lock.readLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.readLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
try
{
@@ -2086,6 +2190,7 @@
finally
{
lock.readLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
}
@@ -2097,7 +2202,19 @@
boolean routed = false;
- lock.readLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.readLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
try
{
@@ -2295,6 +2412,7 @@
finally
{
lock.readLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
return routed;
@@ -2302,7 +2420,19 @@
private Binding removeBindingInMemory(int nodeID, String queueName) throws Exception
{
- lock.writeLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.writeLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
Binding binding = null;
@@ -2364,6 +2494,7 @@
finally
{
lock.writeLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
// Send a notification
@@ -2380,7 +2511,19 @@
if (trace) { log.trace(this + " Adding binding in memory " + binding); }
- lock.writeLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.writeLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
try
{
@@ -2437,6 +2580,7 @@
finally
{
lock.writeLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
if (trace) { log.trace(this + " Sending cluster notification"); }
@@ -2698,7 +2842,19 @@
{
log.debug(this + " cleaning data for node " + nodeToRemove);
- lock.writeLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.writeLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
if (trace) { log.trace(this + " cleaning data for node " + nodeToRemove); }
@@ -2741,6 +2897,7 @@
finally
{
lock.writeLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
Map toNotify = new HashMap();
@@ -2958,7 +3115,19 @@
pm.mergeTransactions(failedNodeID.intValue(), thisNodeID);
// Need to lock
- lock.writeLock().acquire();
+ boolean intr = Thread.interrupted();
+ for (;;)
+ {
+ try
+ {
+ lock.writeLock().acquire();
+ break;
+ }
+ catch (InterruptedException ex)
+ {
+ intr = true;
+ }
+ }
try
{
@@ -3064,6 +3233,7 @@
finally
{
lock.writeLock().release();
+ if (intr) Thread.currentThread().interrupt();
}
//Now clean the data for the failed node
More information about the jboss-cvs-commits
mailing list