[JAVAEETUTORIAL-154] unecessary "while(!mailStatus.isDone())" Created: 15/Feb/13 Updated: 19/Feb/13 Resolved: 19/Feb/13
|Remaining Estimate:||5 minutes|
|Time Spent:||Not Specified|
|Original Estimate:||5 minutes|
In the async EJB example (doc: http://docs.oracle.com/javaee/6/tutorial/doc/gkiez.html) the async.web.MailerManagedBean's send() method contains the following code:
This seems problematic to me on various levels.
Furthermore, in my local code I reworked the example a bit,
This allows me to actually see the "Processing..." status in the browser as well as to refresh the page manually until the status changes. Personally, I find this gives me more of a feeling for the asynchronous nature of the code underneath, rather than experiencing a simple long-running synchronous response in the browser.
|Comment by swiss-chris [ 15/Feb/13 ]|
I ran a quick test with the while-loop, counting the number of times it ran: 2,561,715,398 times !
|Comment by Ian Evans [ 18/Feb/13 ]|
If you email me a ZIP containing your code changes, I'll integrate them into the trunk for Java EE 7.0.
|Comment by swiss-chris [ 18/Feb/13 ]|
Great! I'll send you the ZIP tomorrow. Thanks.
|Comment by Ian Evans [ 19/Feb/13 ]|
I merged in Chris's changes. I kept MailerManagedBean as a CDI bean, but changed the scope to SessionScoped.