diff options
| author | Gordon Sim <gsim@apache.org> | 2014-07-17 13:19:51 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2014-07-17 13:19:51 +0000 |
| commit | 248fbad08295efb9e9f8100741d0d80a62b7630d (patch) | |
| tree | de427b7dd5ca18cb4ff0a06f1441b338f8953b62 /qpid/cpp/src/tests | |
| parent | cb1fbd9ab2250ea775f7c1783339dfaf42dbd3bd (diff) | |
| download | qpid-python-248fbad08295efb9e9f8100741d0d80a62b7630d.tar.gz | |
QPID-5887: revised approach to implict abort
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1611349 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests')
| -rw-r--r-- | qpid/cpp/src/tests/qpid-txtest2.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/qpid/cpp/src/tests/qpid-txtest2.cpp b/qpid/cpp/src/tests/qpid-txtest2.cpp index e9fa4282d4..cdd263a081 100644 --- a/qpid/cpp/src/tests/qpid-txtest2.cpp +++ b/qpid/cpp/src/tests/qpid-txtest2.cpp @@ -186,18 +186,27 @@ struct Transfer : public TransactionalClient, public Runnable Sender sender(session.createSender(target)); Receiver receiver(session.createReceiver(source)); receiver.setCapacity(opts.capacity); - for (uint t = 0; t < opts.txCount; t++) { - for (uint m = 0; m < opts.msgsPerTx; m++) { - Message msg = receiver.fetch(Duration::SECOND*30); - if (msg.getContentSize() != opts.size) { - std::ostringstream oss; - oss << "Message size incorrect: size=" << msg.getContentSize() << "; expected " << opts.size; - throw std::runtime_error(oss.str()); + for (uint t = 0; t < opts.txCount;) { + try { + for (uint m = 0; m < opts.msgsPerTx; m++) { + Message msg = receiver.fetch(Duration::SECOND*30); + if (msg.getContentSize() != opts.size) { + std::ostringstream oss; + oss << "Message size incorrect: size=" << msg.getContentSize() << "; expected " << opts.size; + throw std::runtime_error(oss.str()); + } + sender.send(msg); } - sender.send(msg); + session.commit(); + t++; + if (!opts.quiet && t % 10 == 0) std::cout << "Transaction " << t << " of " << opts.txCount << " committed successfully" << std::endl; + } catch (const TransactionAborted&) { + std::cout << "Transaction " << (t+1) << " of " << opts.txCount << " was aborted and will be retried" << std::endl; + session = connection.createTransactionalSession(); + sender = session.createSender(target); + receiver = session.createReceiver(source); + receiver.setCapacity(opts.capacity); } - QPID_LOG(info, "Moved " << opts.msgsPerTx << " from " << source << " to " << target); - session.commit(); } sender.close(); receiver.close(); |
