summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java10
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java20
2 files changed, 21 insertions, 9 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
index ab1db4933f..fdfdc61eb5 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
@@ -221,8 +221,14 @@ public class AMQSession_0_10 extends AMQSession
public void sendCommit() throws AMQException, FailoverException
{
getQpidSession().setAutoSync(true);
- getQpidSession().txCommit();
- getQpidSession().setAutoSync(false);
+ try
+ {
+ getQpidSession().txCommit();
+ }
+ finally
+ {
+ getQpidSession().setAutoSync(false);
+ }
// We need to sync so that we get notify of an error.
getCurrentException();
}
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
index 0702a52783..5eb066ec36 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
+++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
@@ -212,17 +212,23 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer
boolean sync = (deliveryMode == DeliveryMode.PERSISTENT &&
getSession().getAMQConnection().getSyncPersistence());
- if(sync)
+ if (sync)
{
ssn.setAutoSync(true);
}
- ssn.messageTransfer(destination.getExchangeName().toString(),
- message.get010Message(),
- ssn.TRANSFER_CONFIRM_MODE_NOT_REQUIRED,
- ssn.TRANSFER_ACQUIRE_MODE_PRE_ACQUIRE);
- if (sync)
+ try
+ {
+ ssn.messageTransfer(destination.getExchangeName().toString(),
+ message.get010Message(),
+ ssn.TRANSFER_CONFIRM_MODE_NOT_REQUIRED,
+ ssn.TRANSFER_ACQUIRE_MODE_PRE_ACQUIRE);
+ }
+ finally
{
- ssn.setAutoSync(false);
+ if (sync)
+ {
+ ssn.setAutoSync(false);
+ }
}
}
catch (IOException e)