[ 
https://issues.apache.org/jira/browse/WICKET-6384?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16030130#comment-16030130
 ] 

Dominik Bieliński commented on WICKET-6384:
-------------------------------------------

I'm not sure if I understand your solution correctly. If I use a spring bean, 
it would have to contain some sort of Map<T, Boolean> to store [identifier, 
result] pairs. However, in real world scenario it is not just a result state, 
but also lots of data coming from database that would need to be saved in that 
bean in order to show it later. This will result in Map getting very big in 
size very fast - we can only remove map entries when the check for isDone() 
returns true - we can then just set all data as field in actual wicket 
component. But what happens if user changes page before data is fetched? We 
will never know if we're allowed to remove entry from Map (suppose fetching 
data could take minutes). 

Also, I'm adding just 1 AbstractAjaxTimerBehavior per component (each component 
fetching different data in different times). I guess you could add just 1 timer 
to page and then find all such components with visitChildren, but I think that 
might be very slow on heavy pages.

I uploaded new version with your suggestion as I understood it - it works but 
I'm afraid of size issue mentioned above. Hope you have time to look at it. 
Thanks for answering.

> Current page is serialized in case of multiple ajax requests on previous page
> -----------------------------------------------------------------------------
>
>                 Key: WICKET-6384
>                 URL: https://issues.apache.org/jira/browse/WICKET-6384
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.7.0
>            Reporter: Dominik Bieliński
>            Assignee: Sven Meier
>         Attachments: demo_2.rar, demo.rar
>
>
> We have multiple pages that each contains multiple (>10) components that are 
> scheduling DB queries to a thread pool. Each component is using 
> AbstractAjaxTimerBehavior to check whether or not the data has been already 
> fetched with very low timer interval (30 miliseconds). The issue is that 
> under the presence of MANY ajax requests (almost every possible milisecond), 
> if the user navigates to some other page, that new page is serialized 
> instantly - after new page is created, there is usually 1 or 2 requests from 
> old page still passing through. I created simple spring boot project to 
> demonstrate what I mean. The flow is as below:
> 1. Start on HomePage with just 1 component with AbstractAjaxTimerBehavior 
> 2. Click on TestPage button to move to TestPage with >10 such components
> 3. Before most components are finished fetching data, navigate to HomePage 
> again by clicking HomePage button.
> 4. The component on HomePage will now never finish loading, because I think 
> it has been serialized and deserialized just after creation (thus the 
> reference to Provider variable has changed, which means that originally 
> created thread will never update the correct object) - just after new page is 
> created, there is usually one more request coming from old page that probably 
> involves serialization of new page.
> You can check System.out logs which clearly show what's happening when 
> switching from TestPage to HomePage.
> The problem is resolved by increasing timer interval of updating to, for 
> instance, 200 miliseconds. However I don't think interval itself is the issue 
> here, because in theory you could have hundreds of such components and thus 
> further increase of interval would be needed to avoid the issue.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to