You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2012/08/01 10:22:12 UTC

wicket-ajax.js: FunctionsExecuter

Hi,

Does someone remember what was the reason to introduce
FunctionsExecuter (FE) in wicket-ajax.js ?
It is used to execute functions which do the header contributions,
component replacements, code evaluations, etc.

I'm trying to see what is the real value of it.
Its JSDoc says that it tries to process the steps/functions
synchronously by using notify() but the processing will be synchronous
even without using FE at all. Header contributions, priority
evaluations, component replacements, ... will be processed
synchronously in #onSuccess() callback without the need of FE and the
additional functions which are executed in the same stack.

There are few problems with FE that I see:

1) if notify() is not executed by some step (due to thrown exception,
for example) then the ChannelManager may not release the current
channel. This will lead to a deadlock in the execution of Ajax
requests in this channel for any following click, change, blur, ...

2) FE#notify() leads to filling up the thread stack. Currently there
is a counter (FE#depth) that uses setTimeout() when the depth is 50.
But this setTimeout() breaks the synchronous/atomic execution of the
steps and may lead (as in
https://issues.apache.org/jira/browse/WICKET-4675) to interleaved
execution of several Ajax responses.

-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Re: wicket-ajax.js: FunctionsExecuter

Posted by Martin Grigorov <mg...@apache.org>.
To answer to myself:

FunctionsExecuter is needed because header contributions use
asynchronous callbacks to notify when the JS/CSS is downloaded. This
way JS evaluations can depend on newly added <script>.

I've updated the JSDoc.

On Wed, Aug 1, 2012 at 11:22 AM, Martin Grigorov <mg...@apache.org> wrote:
> Hi,
>
> Does someone remember what was the reason to introduce
> FunctionsExecuter (FE) in wicket-ajax.js ?
> It is used to execute functions which do the header contributions,
> component replacements, code evaluations, etc.
>
> I'm trying to see what is the real value of it.
> Its JSDoc says that it tries to process the steps/functions
> synchronously by using notify() but the processing will be synchronous
> even without using FE at all. Header contributions, priority
> evaluations, component replacements, ... will be processed
> synchronously in #onSuccess() callback without the need of FE and the
> additional functions which are executed in the same stack.
>
> There are few problems with FE that I see:
>
> 1) if notify() is not executed by some step (due to thrown exception,
> for example) then the ChannelManager may not release the current
> channel. This will lead to a deadlock in the execution of Ajax
> requests in this channel for any following click, change, blur, ...
>
> 2) FE#notify() leads to filling up the thread stack. Currently there
> is a counter (FE#depth) that uses setTimeout() when the depth is 50.
> But this setTimeout() breaks the synchronous/atomic execution of the
> steps and may lead (as in
> https://issues.apache.org/jira/browse/WICKET-4675) to interleaved
> execution of several Ajax responses.
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com