Hi, It looks like a good idea. I can see the advantages this brings to the bean developer. I do not understand why we will need a latch that counts up and down for this though. If the container itself calls latch.countdown won't a countdown latch be enough?
Regards Manu On Wed, Aug 6, 2008 at 12:07 AM, David Blevins <[EMAIL PROTECTED]> wrote: > > On Aug 5, 2008, at 5:23 AM, Karan Malhi wrote: > >> Question:- What would be the use-case to call an asynchronous method and >> expect synchronous behavior? > > Not *an* asynchronous method (singular) but *multiple* asynchronous methods > (plural). Do methods A, B, and C in parallel and wait for them to complete > before continuing. The asynchronous methods could each be doing a web > service call, for example, that gather data needed to start the real work. > > It's essentially what you could do on your own with a CountDownLatch but > cannot do reliably as you are not in control of the threads or even the > method execution. Passing a CountDownLatch as a parameter to the > asynchronous methods you call and having the methods themselves call > latch.countDown() isn't going to work as the container can throw exceptions > before and after a bean method call. You have no easy way of knowing if the > bean method called countDown(). > > -David > >
