diff --git a/src/org/jgroups/protocols/TransferQueueBundler.java b/src/org/jgroups/protocols/TransferQueueBundler.java index 08f76b9ca8..1628e317e6 100644 --- a/src/org/jgroups/protocols/TransferQueueBundler.java +++ b/src/org/jgroups/protocols/TransferQueueBundler.java @@ -81,7 +81,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(); @@ -107,7 +112,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) @@ -127,6 +132,9 @@ public void run() { num_sends_because_no_msgs++; } } + catch(InterruptedException e) { + Thread.currentThread().interrupt(); + } catch(Throwable t) { log.trace("%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 41e05b68b0..07e78f53f3 100644 --- a/src/org/jgroups/protocols/TransferQueueBundler2.java +++ b/src/org/jgroups/protocols/TransferQueueBundler2.java @@ -136,7 +136,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(); @@ -156,7 +161,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) @@ -181,7 +186,11 @@ public void run() { sendBundledMessages(); } } + catch(InterruptedException e) { + Thread.currentThread().interrupt(); + } catch(Throwable t) { + log.warn("%s: failed sending message: %s", transport.addr(), t); } } }