logo       

RE: postHook behavior change in 2.0 RC2?: msg#00168

java.dwr.user

Subject: RE: postHook behavior change in 2.0 RC2?

Vinay,

The definition of postHook according to
http://getahead.ltd.uk/dwr/browser/engine
is "Function called just after the remote call" which I guess is
more to-the-point in RC2 as it calls postHook directly after the
remote response arrives and before any callbacks are triggered.
(You mention that postHook triggers after the calls have been
remoted, but it actually triggers after the replies have arrived
but before unmarshalling them.)

Personally, I agree with your preference for the M4b behaviour as
it allows you to do a little processing in each callback and then
afterwards do some more processing in postHook after all callbacks
have been executed.
Though, you really have to wait and see what Joe has to say about
this as he made this change, and maybe did it for a good reason.

The naive workaround in the meantime is to update your example
with this "kludge":
postHook:
function() {
setTimeout(
function() {alert('postHook - invoked');},
0);
}

Best regards
Mike

> -----Original Message-----
> From: Vinay A. Jain [mailto:vinayj1-/E1597aS9LQAvxtiuMwx3w@xxxxxxxxxxxxxxxx]
> Sent: den 16 februari 2007 19:38
> To: users-EyPigyGktj4FDOXUYO6UHQ@xxxxxxxxxxxxxxxx
> Subject: [dwr-user] postHook behavior change in 2.0 RC2?
>
>
> I recently updated my DWR library from 2.0 RC1 (2.0M4b) to
> 2.0 RC2 and have
> noticed a difference in the behavior of the
> DWREngine.endBatch, postHook
> behavior. Below is some sample code w/output that demonstrates the
> difference.
>
> DWREngine.beginBatch();
> myDwrService.methodA(
> param1,
> function() {
> alert('methodA - completed');
> }
> );
> myDwrService.methodB(
> param1,
> function() {
> alert('methodB - completed');
> }
> );
> DWREngine.endBatch(
> async:true;
> preHook:
> function() {
> alert('preHook - invoked');
> }
> postHook:
> function() {
> alert('postHook - invoked');
> }
> );
>
> 2.0 RC1 (2.0M4b) Output:
> preHook - invoked
> methodA - completed
> methodB - completed
> postHook - invoked
>
> 2.0 RC2 Output:
> preHook - invoked
> postHook - invoked
> methodA - completed
> methodB - completed
>
> The difference here is that postHook handler in RC2 is
> invoked after all
> calls within the batch have been *remoted* where as in RC1
> the postHook was
> invoked after all calls *responded*. This difference is
> causing me some
> grief. Is there a way in RC2 to determine when all calls
> within a batch have
> completed (i.e. responded)? I have subsequent processing that
> must take
> place after all calls in the batch have responded to the client.
>
> Thanks.
>
> --
> View this message in context:
> http://www.nabble.com/postHook-behavior-change-in-2.0-RC2--tf3
241170.html#a9009990
> Sent from the DWR - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe-EyPigyGktj4FDOXUYO6UHQ@xxxxxxxxxxxxxxxx
> For additional commands, e-mail:
> users-help-EyPigyGktj4FDOXUYO6UHQ@xxxxxxxxxxxxxxxx
>
>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise