- final Boolean terminatedCohort =
- new ExpectMsg<Boolean>("Terminated Cohort") {
- protected Boolean match(Object in) {
- if (in instanceof Terminated) {
- return cohorActorRef.equals(((Terminated) in).actor());
- } else {
- throw noMatch();
- }
- }
- }.get(); // this extracts the received message
-
- Assert.assertTrue(terminatedCohort);
-
-
- final Boolean terminatedTransaction =
- new ExpectMsg<Boolean>("Terminated Transaction") {
- protected Boolean match(Object in) {
- if (in instanceof Terminated) {
- return transactionActorRef.equals(((Terminated) in).actor());
- } else {
- throw noMatch();
- }
- }
- }.get(); // this extracts the received message
-
- Assert.assertTrue(terminatedTransaction);
-
- final Boolean commitDone =
- new ExpectMsg<Boolean>("CommitTransactionReply") {
- protected Boolean match(Object in) {
- if (in instanceof CommitTransactionReply) {
- return true;
- } else {
- throw noMatch();
- }
- }
- }.get(); // this extracts the received message
+ // 6. Commit the transaction
+ cohort.tell(new CommitTransaction().toSerializable(), getRef());