diff --git a/src/org/jgroups/protocols/TransferQueueBundler.java b/src/org/jgroups/protocols/TransferQueueBundler.java index d1c57bf62e..e9b4c6e12d 100644 --- a/src/org/jgroups/protocols/TransferQueueBundler.java +++ b/src/org/jgroups/protocols/TransferQueueBundler.java @@ -88,7 +88,12 @@ public synchronized void stop() { if(tmp != null) { tmp.interrupt(); if(tmp.isAlive()) { - try {tmp.join(500);} catch(InterruptedException e) {} + try { + tmp.join(500); + } + catch(InterruptedException e) { + Thread.currentThread().interrupt(); + } } } drain(); @@ -110,7 +115,7 @@ public void send(Message msg) throws Exception { } public void run() { - while(running) { + while(!Thread.currentThread().isInterrupted()) { Message msg=null; try { if((msg=queue.take()) == null) @@ -132,6 +137,9 @@ public void run() { sendBundledMessages(); } } + catch(InterruptedException e) { + Thread.currentThread().interrupt(); + } catch(Throwable t) { log.warn("%s: failed sending message: %s", transport.addr(), t); } diff --git a/src/org/jgroups/protocols/TransferQueueBundler2.java b/src/org/jgroups/protocols/TransferQueueBundler2.java index 11a1927a15..1f5910fa9c 100644 --- a/src/org/jgroups/protocols/TransferQueueBundler2.java +++ b/src/org/jgroups/protocols/TransferQueueBundler2.java @@ -138,7 +138,12 @@ public synchronized void stop() { if(tmp != null) { tmp.interrupt(); if(tmp.isAlive()) { - try {tmp.join(500);} catch(InterruptedException e) {} + try { + tmp.join(500); + } + catch(InterruptedException e) { + Thread.currentThread().interrupt(); + } } } drain(); @@ -154,7 +159,7 @@ public void send(Message msg) throws Exception { } public void run() { - while(running) { + while(!Thread.currentThread().isInterrupted()) { Message msg=null; try { if((msg=queue.take()) == null) @@ -179,7 +184,11 @@ public void run() { sendBundledMessages(); } } + catch(InterruptedException e) { + Thread.currentThread().interrupt(); + } catch(Throwable t) { + log.warn("%s: failed sending message: %s", transport.addr(), t); } } }