Re: T5: Service and thread
you have to call your code in a separate Thread ... it can be inline as well.. private int progress; public void getAll(){ final Sth myVar new Thread(new Runnable(){ public void run(){ do long running code here, and set progress variable if possible } }).start(); } after this you have to bind this task to the your ASO so you can access it and display progress on the page ... these are just pointers ... the rest is on you :):) Davor Hrg On Jan 26, 2008 1:01 AM, Angelo Chen <[EMAIL PROTECTED]> wrote: > > Hi Davor, > > getAll is not async, it will not return immediately, how to make a service > async? thanks. > > > > > Davor Hrg wrote: > > > > are you sure > > fileService.getAll(); > > is async and returns immediately ? > > > > Davor Hrg > > > > > > > > On Jan 25, 2008 4:36 PM, Angelo Chen <[EMAIL PROTECTED]> wrote: > >> > >> Hi Davor, > >> > >> the service downloads files from remote server which takes quite long > >> time, > >> the code is: > >> > >> @Inject private FileService fileService; > >> > >> Class onActionFromTest() throws Exception { > >> > >>try { > >> fileService.getAll(); > >>} > >>} catch (CodeExistsException e) { > >>e.printStackTrace(); > >>} > >>return null; > >>} > >> > >> after the call fileService.getAll(), the cursor in the browser at that > >> time > >> is in the 'wait' state, i have to click another page to bring the cursor > >> back to normal. > >> > >> > >> > >> > >> > >> Davor Hrg wrote: > >> > > >> > hm.. I'm not following you ... > >> > > >> > you say you download sth ... > >> > does your service download sth from some server to yourown > >> > or is browser downloading from your server ... > >> > could you say more about your case ... some ceode mybe ... > >> > > >> > > >> > Davor Hrg > >> > > >> > On Jan 25, 2008 11:08 AM, Angelo Chen <[EMAIL PROTECTED]> > >> wrote: > >> >> > >> >> Hi Davor, Andy, > >> >> > >> >> Thanks for the reply, what I do now is, just start the service, and i > >> >> can > >> >> go to other pages as well, but if I stay in the same page where i > >> start > >> >> the > >> >> service, the cursor will be in the 'wait' state, i have to leave the > >> page > >> >> first, any idea? > >> >> > >> >> A.C. > >> >> > >> >> > >> >> Davor Hrg wrote: > >> >> > > >> >> > Tapestry-ioc will not generate threads for you, > >> >> > taopestry-ioc makes sure that some resources are unique per thread, > >> >> > and threads can be generated where ever. They mostly come from > >> >> underlaying > >> >> > server for each request. > >> >> > > >> >> > > >> >> > >> >> -- > >> >> View this message in context: > >> >> > >> http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15084799.html > >> >> > >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. > >> >> > >> >> > >> >> - > >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> >> For additional commands, e-mail: [EMAIL PROTECTED] > >> >> > >> >> > >> > > >> > - > >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > >> > For additional commands, e-mail: [EMAIL PROTECTED] > >> > > >> > > >> > > >> > >> -- > >> View this message in context: > >> http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15090199.html > >> > >> Sent from the Tapestry - User mailing list archive at Nabble.com. > >> > >> > >> - > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > View this message in context: > http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15099632.html > > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Service and thread
Hi Davor, getAll is not async, it will not return immediately, how to make a service async? thanks. Davor Hrg wrote: > > are you sure > fileService.getAll(); > is async and returns immediately ? > > Davor Hrg > > > > On Jan 25, 2008 4:36 PM, Angelo Chen <[EMAIL PROTECTED]> wrote: >> >> Hi Davor, >> >> the service downloads files from remote server which takes quite long >> time, >> the code is: >> >> @Inject private FileService fileService; >> >> Class onActionFromTest() throws Exception { >> >>try { >> fileService.getAll(); >>} >>} catch (CodeExistsException e) { >>e.printStackTrace(); >>} >>return null; >>} >> >> after the call fileService.getAll(), the cursor in the browser at that >> time >> is in the 'wait' state, i have to click another page to bring the cursor >> back to normal. >> >> >> >> >> >> Davor Hrg wrote: >> > >> > hm.. I'm not following you ... >> > >> > you say you download sth ... >> > does your service download sth from some server to yourown >> > or is browser downloading from your server ... >> > could you say more about your case ... some ceode mybe ... >> > >> > >> > Davor Hrg >> > >> > On Jan 25, 2008 11:08 AM, Angelo Chen <[EMAIL PROTECTED]> >> wrote: >> >> >> >> Hi Davor, Andy, >> >> >> >> Thanks for the reply, what I do now is, just start the service, and i >> >> can >> >> go to other pages as well, but if I stay in the same page where i >> start >> >> the >> >> service, the cursor will be in the 'wait' state, i have to leave the >> page >> >> first, any idea? >> >> >> >> A.C. >> >> >> >> >> >> Davor Hrg wrote: >> >> > >> >> > Tapestry-ioc will not generate threads for you, >> >> > taopestry-ioc makes sure that some resources are unique per thread, >> >> > and threads can be generated where ever. They mostly come from >> >> underlaying >> >> > server for each request. >> >> > >> >> > >> >> >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15084799.html >> >> >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> >> >> >> - >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > - >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15090199.html >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15099632.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Service and thread
are you sure fileService.getAll(); is async and returns immediately ? Davor Hrg On Jan 25, 2008 4:36 PM, Angelo Chen <[EMAIL PROTECTED]> wrote: > > Hi Davor, > > the service downloads files from remote server which takes quite long time, > the code is: > > @Inject private FileService fileService; > > Class onActionFromTest() throws Exception { > >try { > fileService.getAll(); >} >} catch (CodeExistsException e) { >e.printStackTrace(); >} >return null; >} > > after the call fileService.getAll(), the cursor in the browser at that time > is in the 'wait' state, i have to click another page to bring the cursor > back to normal. > > > > > > Davor Hrg wrote: > > > > hm.. I'm not following you ... > > > > you say you download sth ... > > does your service download sth from some server to yourown > > or is browser downloading from your server ... > > could you say more about your case ... some ceode mybe ... > > > > > > Davor Hrg > > > > On Jan 25, 2008 11:08 AM, Angelo Chen <[EMAIL PROTECTED]> wrote: > >> > >> Hi Davor, Andy, > >> > >> Thanks for the reply, what I do now is, just start the service, and i > >> can > >> go to other pages as well, but if I stay in the same page where i start > >> the > >> service, the cursor will be in the 'wait' state, i have to leave the page > >> first, any idea? > >> > >> A.C. > >> > >> > >> Davor Hrg wrote: > >> > > >> > Tapestry-ioc will not generate threads for you, > >> > taopestry-ioc makes sure that some resources are unique per thread, > >> > and threads can be generated where ever. They mostly come from > >> underlaying > >> > server for each request. > >> > > >> > > >> > >> -- > >> View this message in context: > >> http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15084799.html > >> > >> Sent from the Tapestry - User mailing list archive at Nabble.com. > >> > >> > >> - > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > View this message in context: > http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15090199.html > > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Service and thread
Hi Davor, the service downloads files from remote server which takes quite long time, the code is: @Inject private FileService fileService; Class onActionFromTest() throws Exception { try { fileService.getAll(); } } catch (CodeExistsException e) { e.printStackTrace(); } return null; } after the call fileService.getAll(), the cursor in the browser at that time is in the 'wait' state, i have to click another page to bring the cursor back to normal. Davor Hrg wrote: > > hm.. I'm not following you ... > > you say you download sth ... > does your service download sth from some server to yourown > or is browser downloading from your server ... > could you say more about your case ... some ceode mybe ... > > > Davor Hrg > > On Jan 25, 2008 11:08 AM, Angelo Chen <[EMAIL PROTECTED]> wrote: >> >> Hi Davor, Andy, >> >> Thanks for the reply, what I do now is, just start the service, and i >> can >> go to other pages as well, but if I stay in the same page where i start >> the >> service, the cursor will be in the 'wait' state, i have to leave the page >> first, any idea? >> >> A.C. >> >> >> Davor Hrg wrote: >> > >> > Tapestry-ioc will not generate threads for you, >> > taopestry-ioc makes sure that some resources are unique per thread, >> > and threads can be generated where ever. They mostly come from >> underlaying >> > server for each request. >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15084799.html >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15090199.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Service and thread
hm.. I'm not following you ... you say you download sth ... does your service download sth from some server to yourown or is browser downloading from your server ... could you say more about your case ... some ceode mybe ... Davor Hrg On Jan 25, 2008 11:08 AM, Angelo Chen <[EMAIL PROTECTED]> wrote: > > Hi Davor, Andy, > > Thanks for the reply, what I do now is, just start the service, and i can > go to other pages as well, but if I stay in the same page where i start the > service, the cursor will be in the 'wait' state, i have to leave the page > first, any idea? > > A.C. > > > Davor Hrg wrote: > > > > Tapestry-ioc will not generate threads for you, > > taopestry-ioc makes sure that some resources are unique per thread, > > and threads can be generated where ever. They mostly come from underlaying > > server for each request. > > > > > > -- > View this message in context: > http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15084799.html > > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Service and thread
Hi Davor, Andy, Thanks for the reply, what I do now is, just start the service, and i can go to other pages as well, but if I stay in the same page where i start the service, the cursor will be in the 'wait' state, i have to leave the page first, any idea? A.C. Davor Hrg wrote: > > Tapestry-ioc will not generate threads for you, > taopestry-ioc makes sure that some resources are unique per thread, > and threads can be generated where ever. They mostly come from underlaying > server for each request. > > -- View this message in context: http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15084799.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Service and thread
Angelo, Additionally, if you have a job that you want to schedule to do this download, you could use a scheduler such as Quartz to kick off the job without any intervention. Andy On Thu, 2008-01-24 at 01:45 -0800, Angelo Chen wrote: > Hi, > > I have a service which does some file download that takes quite long, I'd > like to run the service in a separate thread, possible with Tapestry Ioc? or > I have to manage the thread manually? Thanks, > > A.C. > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Service and thread
Tapestry-ioc will not generate threads for you, taopestry-ioc makes sure that some resources are unique per thread, and threads can be generated where ever. They mostly come from underlaying server for each request. If you spawn your own thread, you can freely use any threaded resource, just make sure that you call ThreadCleanupHub after thread finishes it's work so tapestry can free the resources. Davor Hrg On Jan 24, 2008 10:45 AM, Angelo Chen <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a service which does some file download that takes quite long, I'd > like to run the service in a separate thread, possible with Tapestry Ioc? or > I have to manage the thread manually? Thanks, > > A.C. > > > -- > View this message in context: > http://www.nabble.com/T5%3A-Service-and-thread-tp15061626p15061626.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]