From da3de2a789f1689d25d4d6ac8afa2d7ee82c8787 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Mon, 20 Aug 2007 13:03:14 +0000 Subject: updated sync git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@567678 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpidity/jms/MessageConsumerImpl.java | 18 +++------- .../java/org/apache/qpidity/jms/SessionImpl.java | 41 +++++++++++++++++++++- 2 files changed, 44 insertions(+), 15 deletions(-) (limited to 'java') diff --git a/java/client/src/main/java/org/apache/qpidity/jms/MessageConsumerImpl.java b/java/client/src/main/java/org/apache/qpidity/jms/MessageConsumerImpl.java index 57b7b7e7ac..e726288f89 100644 --- a/java/client/src/main/java/org/apache/qpidity/jms/MessageConsumerImpl.java +++ b/java/client/src/main/java/org/apache/qpidity/jms/MessageConsumerImpl.java @@ -401,6 +401,7 @@ public class MessageConsumerImpl extends MessageActor implements MessageConsumer // We now release any message received for this consumer _isReceiving = false; _isNoWaitIsReceiving = false; + getSession().testQpidException(); } return result; } @@ -583,8 +584,7 @@ public class MessageConsumerImpl extends MessageActor implements MessageConsumer RangeSet ranges = new RangeSet(); ranges.add(message.getMessageTransferId()); getSession().getQpidSession().messageRelease(ranges); - getSession().getQpidSession().sync(); - testQpidException(); + getSession().testQpidException(); } } @@ -611,7 +611,7 @@ public class MessageConsumerImpl extends MessageActor implements MessageConsumer { result = true; } - testQpidException(); + getSession().testQpidException(); } return result; } @@ -629,17 +629,7 @@ public class MessageConsumerImpl extends MessageActor implements MessageConsumer RangeSet ranges = new RangeSet(); ranges.add(message.getMessageTransferId()); getSession().getQpidSession().messageAcknowledge(ranges); - getSession().getQpidSession().sync(); - testQpidException(); - } - } - - private void testQpidException() throws QpidException - { - QpidException qe = getSession().getCurrentException(); - if (qe != null) - { - throw qe; + getSession().testQpidException(); } } } diff --git a/java/client/src/main/java/org/apache/qpidity/jms/SessionImpl.java b/java/client/src/main/java/org/apache/qpidity/jms/SessionImpl.java index 5994650f34..57a69277a7 100644 --- a/java/client/src/main/java/org/apache/qpidity/jms/SessionImpl.java +++ b/java/client/src/main/java/org/apache/qpidity/jms/SessionImpl.java @@ -156,7 +156,7 @@ public class SessionImpl implements Session { _qpidSession.txSelect(); } - + testQpidException(); // init the message dispatcher. initMessageDispatcherThread(); } @@ -319,6 +319,14 @@ public class SessionImpl implements Session } // commit the underlying Qpid Session _qpidSession.txCommit(); + try + { + testQpidException(); + } + catch (QpidException e) + { + throw ExceptionHelper.convertQpidExceptionToJMSException(e); + } } /** @@ -342,6 +350,14 @@ public class SessionImpl implements Session } // rollback the underlying Qpid Session _qpidSession.txRollback(); + try + { + testQpidException(); + } + catch (QpidException e) + { + throw ExceptionHelper.convertQpidExceptionToJMSException(e); + } } /** @@ -401,6 +417,14 @@ public class SessionImpl implements Session } // close the underlaying QpidSession _qpidSession.sessionClose(); + try + { + testQpidException(); + } + catch (QpidException e) + { + throw ExceptionHelper.convertQpidExceptionToJMSException(e); + } } } @@ -1083,6 +1107,21 @@ public class SessionImpl implements Session return _connection; } + /** + * sync and return the potential exception + * + * @throws QpidException If an exception has been thrown by the broker. + */ + protected void testQpidException() throws QpidException + { + _qpidSession.sync(); + QpidException qe = getCurrentException(); + if (qe != null) + { + throw qe; + } + } + //------ Private Methods /** * Close the producer and the consumers of this session -- cgit v1.2.1