You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Vit Rozkovec <wi...@rozkovec.info> on 2007/10/04 08:44:44 UTC

Threading wicket

Hallo,
how can I force from a middle of the loop, which may run up to few 
minutes to update a component's value?
I am manipulating a lot of files and I would like to let the user know 
how much of the processing is already done.
I would like to start processing the files when user reaches certain 
page and on this same page I want to display statistics of the process.
As an example I tried to use a Clock from your ajax example, but I 
cannot manage it to update during running of the loop. I thought of 
achieving it somehow with threads, is this right direction?
What is the correct way to do it?

Thank you.

Vitek

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Threading wicket

Posted by Eelco Hillenius <ee...@gmail.com>.
> how can I force from a middle of the loop, which may run up to few
> minutes to update a component's value?
> I am manipulating a lot of files and I would like to let the user know
> how much of the processing is already done.
> I would like to start processing the files when user reaches certain
> page and on this same page I want to display statistics of the process.
> As an example I tried to use a Clock from your ajax example, but I
> cannot manage it to update during running of the loop. I thought of
> achieving it somehow with threads, is this right direction?
> What is the correct way to do it?

Check out org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar.
It's not exactly what you want, but it should give you some ideas.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Threading wicket

Posted by Vit Rozkovec <wi...@rozkovec.info>.
swaroop belur wrote:

> But  mind u- that thread may not have references to stuff like
> ur session,application objects- they might be null. So you will have to
> first get
> the reqd stuff (any dependecies- say something from ur service layer for
> example)
> and then start the thread. 
>
> -swaroop
>   
Would you mind sharing a bit of your code? So far I did 
Application.set(app) in the run() method (app is reference to 
application from standart thread Wicket is running in), but I think this 
is not the right way as the set() method is not part of the public API.

What is the best way to do this?

Thanks alot.

Vitek
>
>
>
> Ví­t Rozkovec wrote:
>   
>> Hallo,
>> how can I force from a middle of the loop, which may run up to few 
>> minutes to update a component's value?
>> I am manipulating a lot of files and I would like to let the user know 
>> how much of the processing is already done.
>> I would like to start processing the files when user reaches certain 
>> page and on this same page I want to display statistics of the process.
>> As an example I tried to use a Clock from your ajax example, but I 
>> cannot manage it to update during running of the loop. I thought of 
>> achieving it somehow with threads, is this right direction?
>> What is the correct way to do it?
>>
>> Thank you.
>>
>> Vitek
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Threading wicket

Posted by swaroop belur <sw...@gmail.com>.

If i understand correctly , I think clock example does not work for you 
because your first ajax request - to handle the files - has to first finish. 
Until that finishes the self updating behavior which is a separate ajax
request 
will not fire. So prob  you will have to do ur file stuff in a separate
thread.
But  mind u- that thread may not have references to stuff like
ur session,application objects- they might be null. So you will have to
first get
the reqd stuff (any dependecies- say something from ur service layer for
example)
and then start the thread. 

I was able to update a simple label to the current file number being handled
for 
example. For this i did the file stuff in a separate thread.


-swaroop





Ví­t Rozkovec wrote:
> 
> Hallo,
> how can I force from a middle of the loop, which may run up to few 
> minutes to update a component's value?
> I am manipulating a lot of files and I would like to let the user know 
> how much of the processing is already done.
> I would like to start processing the files when user reaches certain 
> page and on this same page I want to display statistics of the process.
> As an example I tried to use a Clock from your ajax example, but I 
> cannot manage it to update during running of the loop. I thought of 
> achieving it somehow with threads, is this right direction?
> What is the correct way to do it?
> 
> Thank you.
> 
> Vitek
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Threading-wicket-tf4566130.html#a13034201
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Threading wicket

Posted by Gwyn Evans <gw...@gmail.com>.
On Thursday, October 4, 2007, 7:44:44 AM, Vit <wi...@rozkovec.info> wrote:

> Hallo,
> how can I force from a middle of the loop, which may run up to few 
> minutes to update a component's value?
> I am manipulating a lot of files and I would like to let the user know
> how much of the processing is already done.
> I would like to start processing the files when user reaches certain 
> page and on this same page I want to display statistics of the process.
> As an example I tried to use a Clock from your ajax example, but I 
> cannot manage it to update during running of the loop. I thought of 
> achieving it somehow with threads, is this right direction?
> What is the correct way to do it?

Spin off a worker thread to do the processing.  This thread has to
periodically update a (shared) field to show the progress.

Independently, your page needs to periodically poll the server (best
via AJAX) to retrieve the value of the shared field - this is where
the AjaxSelfUpdatingBehavior in the Clock example belongs. Unlike
Swing, with web-apps, you can't 'push' from the worker thread, just
'pull' from the client.

/Gwyn


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org