Skip to content

Commit

Permalink
JGRP-2835 Do not log warn during normal shutdown.
Browse files Browse the repository at this point in the history
Fix interrupt handling.
  • Loading branch information
pferraro committed Sep 13, 2024
1 parent f80b405 commit 14959c9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/org/jgroups/protocols/TransferQueueBundler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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)
Expand All @@ -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);
}
Expand Down
13 changes: 11 additions & 2 deletions src/org/jgroups/protocols/TransferQueueBundler2.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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)
Expand All @@ -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);
}
}
}
Expand Down

0 comments on commit 14959c9

Please sign in to comment.