Or maybe you can use progressive display?
http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/progressivedisplayvariations

On Tue, Apr 14, 2015 at 1:36 PM, Chris Poulsen <mailingl...@nesluop.dk>
wrote:

> If your prepareData() is non-blocking, why not just call it right before
> you do the token.getData() ? (both in setupRender() )
>
> On Tue, Apr 14, 2015 at 1:03 PM, Тимур Бухараев <bukhar...@gmail.com>
> wrote:
>
>> Hi,
>>
>> My pages consist page class and several components inside.
>>
>> Page and its components needs some information from remote services. I get
>> this information with blocking calls in setupRender(). For example, if i
>> need user's profile data, i get it like this:
>>
>> setupRender() {
>>  profileData = loadProfileDate(); // blocking call, waiting for the
>> response
>> }
>>
>> And now i can use profileData in render to show some information.
>>
>> The problem is page and components need many remote data, so there are
>> many
>> serial requests to remote services. It harms latency, because overall
>> latency is sum of serial requests delays.
>>
>> I have idea to improve latency, sending requests in parallel. I want make
>> non blocking function sendRequest, which returns me token. All components
>> call non blocking sendRequest for remote data, then i'll wait in blocking
>> call waitResponses(), which wait for all responses.Then component get
>> their
>> data from token.
>>
>> Some code for illustration:
>>
>> MyComponent {
>>     @Inject
>>     private RemoteService remoteService;
>>
>>     private Token<Response> token;
>> }
>>
>> void prepareData() {
>>     token = remoteService.sendRequest(); // non blocking call
>> }
>>
>> void setupRender() {
>>     Response response = token.getData(); // first call is blocking, wait
>> for all responses, other calls just return data;
>> }
>>
>> Why i did not just realize my idea and write this post?
>>
>> Because i need two separate phases: first for send request, and second for
>> prepare rendering. All componets should send in first phase, and after get
>> data in second.
>>
>> Tapestry have setupRender and beginRender, but they have another order. It
>> call setupRender and beginRender for first component, and then - for
>> second. But i need phase 1 calls for all components, then phase 2 call for
>> all components.
>>
>> And now my question is: is there any way in Tapestry to create this
>> phases?
>> Thank you for your attention, sorry for my English.
>>
>
>

Reply via email to