From cde8b34227709d91a6d0006ce70e56b555d2a46c Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Mon, 4 Sep 2006 05:50:43 +0000 Subject: [PATCH] https://issues.apache.org/activemq/browse/AMQ-891 git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/branches/activemq-4.0@439941 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/activemq/ActiveMQConnection.java | 1 + .../src/main/java/org/apache/activemq/ActiveMQInputStream.java | 1 + .../main/java/org/apache/activemq/ActiveMQMessageConsumer.java | 1 + .../src/main/java/org/apache/activemq/ActiveMQSession.java | 1 + .../main/java/org/apache/activemq/ActiveMQSessionExecutor.java | 3 ++- .../activemq/store/journal/JournalPersistenceAdapter.java | 1 + .../activemq/store/journal/QuickJournalPersistenceAdapter.java | 1 + .../java/org/apache/activemq/thread/DedicatedTaskRunner.java | 3 ++- .../org/apache/activemq/transport/WireFormatNegotiator.java | 1 + .../transport/discovery/simple/SimpleDiscoveryAgent.java | 1 + .../apache/activemq/transport/failover/FailoverTransport.java | 3 +++ .../org/apache/activemq/transport/fanout/FanoutTransport.java | 2 ++ .../java/org/apache/activemq/transport/udp/UdpTransport.java | 1 + 13 files changed, 18 insertions(+), 2 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java index aa56d627c8..933d846d21 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java @@ -1367,6 +1367,7 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon try { brokerInfoReceived.await(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw JMSExceptionSupport.create(e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQInputStream.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQInputStream.java index 12cde681aa..c1576cec48 100644 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQInputStream.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQInputStream.java @@ -143,6 +143,7 @@ public class ActiveMQInputStream extends InputStream implements ActiveMQDispatch try { md = unconsumedMessages.dequeue(-1); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw JMSExceptionSupport.create(e); } diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java index cce43c6913..4bea438604 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java @@ -394,6 +394,7 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC } } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw JMSExceptionSupport.create(e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java index ad8d311233..2177aa2664 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java @@ -1344,6 +1344,7 @@ public class ActiveMQSession implements Session, QueueSession, TopicSession, Sta try { executor.execute(messageDispatch); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); connection.onAsyncException(e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQSessionExecutor.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQSessionExecutor.java index de11d6cbab..82e66cbbe0 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQSessionExecutor.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQSessionExecutor.java @@ -114,6 +114,7 @@ public class ActiveMQSessionExecutor implements Task { taskRunner.shutdown(); } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw JMSExceptionSupport.create(e); } } @@ -156,4 +157,4 @@ public class ActiveMQSessionExecutor implements Task { return messageQueue.removeAll(); } -} \ No newline at end of file +} diff --git a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java index 35c2b1ac39..6bdf63dd9f 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java @@ -307,6 +307,7 @@ public class JournalPersistenceAdapter implements PersistenceAdapter, JournalEve } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("Request to start checkpoint failed: " + e, e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/journal/QuickJournalPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/journal/QuickJournalPersistenceAdapter.java index b12abd8d01..e7de9ce71c 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/journal/QuickJournalPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/journal/QuickJournalPersistenceAdapter.java @@ -306,6 +306,7 @@ public class QuickJournalPersistenceAdapter implements PersistenceAdapter, Journ } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("Request to start checkpoint failed: " + e, e); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/thread/DedicatedTaskRunner.java b/activemq-core/src/main/java/org/apache/activemq/thread/DedicatedTaskRunner.java index 64819fa089..0321e06471 100644 --- a/activemq-core/src/main/java/org/apache/activemq/thread/DedicatedTaskRunner.java +++ b/activemq-core/src/main/java/org/apache/activemq/thread/DedicatedTaskRunner.java @@ -98,6 +98,7 @@ class DedicatedTaskRunner implements TaskRunner { } catch (InterruptedException e) { // Someone really wants this thread to die off. + Thread.currentThread().interrupt(); } finally { // Make sure we notify any waiting threads that thread // has terminated. @@ -107,4 +108,4 @@ class DedicatedTaskRunner implements TaskRunner { } } } -} \ No newline at end of file +} diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java b/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java index aaa795f145..e961a0af06 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java @@ -81,6 +81,7 @@ public class WireFormatNegotiator extends TransportFilter { if( !readyCountDownLatch.await(negotiateTimeout, TimeUnit.MILLISECONDS) ) throw new IOException("Wire format negociation timeout: peer did not send his wire format."); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new InterruptedIOException(); } super.oneway(command); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java index 3fcf7b0284..b56430049d 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java @@ -138,6 +138,7 @@ public class SimpleDiscoveryAgent implements DiscoveryAgent { sleepMutex.wait(event.reconnectDelay); }catch(InterruptedException ie){ + Thread.currentThread().interrupt(); return; } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java index 597ceb6546..f8e6be73db 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java @@ -112,6 +112,7 @@ public class FailoverTransport implements CompositeTransport { handleTransportFailure(error); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); transportListener.onException(new InterruptedIOException()); } } @@ -345,6 +346,7 @@ public class FailoverTransport implements CompositeTransport { reconnectMutex.wait(1000); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.debug("Interupted: " + e, e); } } @@ -394,6 +396,7 @@ public class FailoverTransport implements CompositeTransport { } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); // Some one may be trying to stop our thread. throw new InterruptedIOException(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java index 156229fba2..78aa89830f 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java @@ -142,6 +142,7 @@ public class FanoutTransport implements CompositeTransport { } } catch (InterruptedException e) { + Thread.currentThread().interrupt(); transportListener.onException(new InterruptedIOException()); } } @@ -394,6 +395,7 @@ public class FanoutTransport implements CompositeTransport { } } catch (InterruptedException e) { // Some one may be trying to stop our thread. + Thread.currentThread().interrupt(); throw new InterruptedIOException(); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java index 53b8c734c2..956eac15bf 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java @@ -407,6 +407,7 @@ public class UdpTransport extends TransportThreadSupport implements Transport, S try { Thread.sleep(BIND_ATTEMPT_DELAY); } catch (InterruptedException e1) { + Thread.currentThread().interrupt(); throw e; } }