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]

Reply via email to