https://issues.apache.org/activemq/browse/AMQ-1807 - aborting transaction test revisited + solution

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@804192 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2009-08-14 12:29:58 +00:00
parent c2205356ff
commit a15e6efabd
2 changed files with 10 additions and 0 deletions

View File

@ -188,6 +188,15 @@ public class StompConnection {
}
public void abort(String transaction) throws Exception {
// discard all content on the wire before
// aborting the transaction
try {
StompFrame discarded = this.receive(100);
while (discarded != null) {
discarded = this.receive(100);
}
} catch (Exception e) {
}
HashMap<String, String> headers = new HashMap<String, String>();
headers.put("transaction", transaction);
StompFrame frame = new StompFrame("ABORT", headers);

View File

@ -972,6 +972,7 @@ public class StompTest extends CombinationTestSupport {
} catch (SocketTimeoutException soe) {}
stompConnection.ack(frame1, "tx1");
Thread.sleep(1000);
stompConnection.abort("tx1");
stompConnection.begin("tx2");