Permalink
Browse files

Fixed race condition in example application.

  • Loading branch information...
krasserm committed Apr 8, 2011
1 parent 51ba2e0 commit 7e1403d6fef50701822865894b369df9980931fe
Showing with 9 additions and 3 deletions.
  1. +9 −3 scalaz-camel-samples/src/main/scala/scalaz/camel/samples/CoreExample.scala
@@ -133,9 +133,15 @@ object CoreExample extends Camel {
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
- val latch = new CountDownLatch(1)
- placeOrderRoute apply orderMessage.success respond { mv => assertOrderProcessed(mv); latch.countDown }
- if (!latch.await(10, TimeUnit.SECONDS)) throw new Exception("unexpected order processing failure")
+ assertOrderProcessed {
+ var result: MessageValidation = Message("no response").fail
+ val latch = new CountDownLatch(1)
+
+ placeOrderRoute apply orderMessage.success respond { mv => result = mv; latch.countDown }
+ latch.await(10, TimeUnit.SECONDS)
+
+ result
+ }
}
// -----------------------------------------------------------------

0 comments on commit 7e1403d

Please sign in to comment.