Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed race condition in example application.

  • Loading branch information...
commit 7e1403d6fef50701822865894b369df9980931fe 1 parent 51ba2e0
@krasserm authored
View
12 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
+ }
}
// -----------------------------------------------------------------
Please sign in to comment.
Something went wrong with that request. Please try again.