Re: parallel remote requests in Tapestry

2015-04-18 Thread Lance Java
This sounded like a fun challenge so I implemented it in tapestry-stitch Demo here with source code: http://t5stitch-lazan.rhcloud.com/paralleldemo Rendering all happens on the request thread, workers are invoked in parallel. Enjoy!

Re: parallel remote requests in Tapestry

2015-04-15 Thread Lance Java
For this to work, I think the actual rendering needs to happen on the request thread. See the gist here: https://gist.github.com/anonymous/379b3aae199147684841 By using the parallel component you can ask for an Invokable (which does the 'work') and a binding (the property to set). You would

Re: parallel remote requests in Tapestry

2015-04-14 Thread Chris Poulsen
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

Re: parallel remote requests in Tapestry

2015-04-14 Thread Dmitry Gusev
Hi, could you create a Future in your setupRender and use actual results w/ Future.get() during the rendering? As Chris said I'd also recommend you looking at the ProgressiveDisplay component. On Tue, Apr 14, 2015 at 2:56 PM, Тимур Бухараев bukhar...@gmail.com wrote: I can't call both in

Re: parallel remote requests in Tapestry

2015-04-14 Thread Тимур Бухараев
sorry, some mistake in sequence it should be: component1.setupRender(); other component1 rendering component2.setupRender(); other component2 rendering On Tue, Apr 14, 2015 at 3:17 PM, Тимур Бухараев bukhar...@gmail.com wrote: Hello, Future would not helps, because components renders one

Re: parallel remote requests in Tapestry

2015-04-14 Thread Тимур Бухараев
I can't call both in setupRender, because i need one blocking wait to receive all requests in parallel. Steps: 1. prepareData(), all components send their request for data, remember all requests. 2. setupRender(), all components gets data from tokens. getData() could be like this: Response

Re: parallel remote requests in Tapestry

2015-04-14 Thread Тимур Бухараев
Hello, Future would not helps, because components renders one after one. For example page contains component1 and component2. The render sequence is next: component1.setupRender(); other component1 rendering component1.setupRender(); other component2 rendering So if i create Future in

Re: parallel remote requests in Tapestry

2015-04-14 Thread Chris Poulsen
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

Re: parallel remote requests in Tapestry

2015-04-14 Thread Thiago H de Paula Figueiredo
On Tue, 14 Apr 2015 09:22:36 -0300, Тимур Бухараев bukhar...@gmail.com wrote: sorry, some mistake in sequence it should be: component1.setupRender(); other component1 rendering component2.setupRender(); other component2 rendering If you think Future is not the way to go (and that's what

Re: parallel remote requests in Tapestry

2015-04-14 Thread Thiago H de Paula Figueiredo
On Tue, 14 Apr 2015 11:08:11 -0300, Тимур Бухараев bukhar...@gmail.com wrote: I don't know how to solve my problem with Future. If you know, explain please. That's not a Tapestry-specific question, so I suggest you to find and read tutorials like this:

Re: parallel remote requests in Tapestry

2015-04-14 Thread Cezary Biernacki
Hi Тимур, Have you tried putting your asynchronous in pageAttached() methods (also see @PageAttached annotation) in your components? https://tapestry.apache.org/page-life-cycle.html However pageAttached is invoked on all pages that are somehow involved in the request processing (e.g. they are

Re: parallel remote requests in Tapestry

2015-04-14 Thread Тимур Бухараев
I don't know how to solve my problem with Future. If you know, explain please. ProgressiveDisplay is a solution, but has some disadvantages. Now about moving data fetch logic. The problem is components are independent. Page class doesn't know about Component classes, component classes don't

Re: parallel remote requests in Tapestry

2015-04-14 Thread Thiago H de Paula Figueiredo
On Tue, 14 Apr 2015 14:05:33 -0300, Cezary Biernacki cezary...@gmail.com wrote: Hi Тимур, Have you tried putting your asynchronous in pageAttached() methods (also see @PageAttached annotation) in your components? https://tapestry.apache.org/page-life-cycle.html However pageAttached is

Re: parallel remote requests in Tapestry

2015-04-14 Thread Тимур Бухараев
Yes, i tried PageAttached. I put logs to see call sequences. PageAttached works fine for page class, but i see many chaotic calls per component. I expect one call per request per component, but see there are many calls per component. I dont know why. Heartbeat is really interesting option. Thank

Re: parallel remote requests in Tapestry

2015-04-14 Thread Тимур Бухараев
I know about mechanics of Future and other java.utils.concurrent. I don't know how it helps to solve my question. Future.get() is just a kind of blocking call. If i have two independent components, i should call Future.get() two times in their setupRender. So i get two consecutive delays. Overall

Re: parallel remote requests in Tapestry

2015-04-14 Thread Cezary Biernacki
As I wrote before, PageAttached is invoked on all pages somehow related to request (e.g. if some component uses @InjectPage to refer some other page), not only on rendered page. I have not really used PageAttached in the production code myself, so it is only speculations, but maybe you could

Re: parallel remote requests in Tapestry

2015-04-14 Thread Thiago H de Paula Figueiredo
On Tue, 14 Apr 2015 16:04:27 -0300, Тимур Бухараев bukhar...@gmail.com wrote: Heartbeat is really interesting option. Thank you for idea. The next my question is: how update template with actual content in deffered commands? Templates cannot be rendered in a deferred way. What Label does

Re: parallel remote requests in Tapestry

2015-04-14 Thread Thiago H de Paula Figueiredo
On Tue, 14 Apr 2015 16:17:48 -0300, Тимур Бухараев bukhar...@gmail.com wrote: The question is really about Tapestry rendering pipeline. I need iterate over all components in page before they start render, to send remote requests. Well, in a page or component you can @Inject

Re: parallel remote requests in Tapestry

2015-04-14 Thread Cezary Biernacki
It seems that PageAttached was un-deprecated in 5.4 some time ago, however I am not sure about the motivation: https://apache.googlesource.com/tapestry-5/+/0998b92d51d475ed20fa5aadea06bc5bd37c39a8%5E%21/ I believe that PageAttached can still be useful even when there is no page pool. The code