You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2019/09/24 16:13:58 UTC
[qpid-jms] 03/03: QPIDJMS-473: improve handling/logging of
exceptions during async completion
This is an automated email from the ASF dual-hosted git repository.
robbie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-jms.git
commit 9cad42da6fae11811ec1aea140705b3c59ac88cd
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Tue Sep 24 17:04:27 2019 +0100
QPIDJMS-473: improve handling/logging of exceptions during async completion
---
.../main/java/org/apache/qpid/jms/JmsSession.java | 25 ++++++++++++++--------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java
index d3b30c5..7015a6f 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java
@@ -1485,6 +1485,7 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe
try {
completion.signalCompletion();
} catch (Throwable error) {
+ LOG.error("Failure while performing completion for send: {}", completion.envelope, error);
} finally {
LOG.trace("Signaled completion of send: {}", completion.envelope);
}
@@ -1526,8 +1527,7 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe
}
completion.signalCompletion();
} catch (Throwable error) {
- LOG.trace("Failed while performing send completion: {}", envelope);
- // TODO - What now?
+ LOG.error("Failure while performing completion for send: {}", envelope, error);
}
// Signal any trailing completions that have been marked complete
@@ -1539,8 +1539,7 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe
try {
completion.signalCompletion();
} catch (Throwable error) {
- LOG.trace("Failed while performing send completion: {}", envelope);
- // TODO - What now?
+ LOG.error("Failure while performing completion for send: {}", envelope, error);
} finally {
pending.remove();
}
@@ -1564,8 +1563,7 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe
}
}
} catch (Exception ex) {
- LOG.debug("Send completion task encounted unexpected error: {}", ex.getMessage());
- // TODO - What now
+ LOG.error("Async completion task encountered unexpected failure", ex);
}
}
}
@@ -1597,12 +1595,21 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe
}
public void signalCompletion() {
- envelope.getMessage().onSendComplete(); // Ensure message is returned as readable.
+ JmsMessage message = envelope.getMessage();
+ message.onSendComplete(); // Ensure message is returned as readable.
if (failureCause == null) {
- listener.onCompletion(envelope.getMessage());
+ try {
+ listener.onCompletion(message);
+ } catch (Exception ex) {
+ LOG.trace("CompletionListener threw exception from onCompletion for send {}", envelope, ex);
+ }
} else {
- listener.onException(envelope.getMessage(), failureCause);
+ try {
+ listener.onException(message, failureCause);
+ } catch (Exception ex) {
+ LOG.trace("CompletionListener threw exception from onException for send {}", envelope, ex);
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org