Mathias, is there any way you can give a more complete code sample? It might shed some light on what's going on.
-T On Wed, Feb 24, 2010 at 8:19 AM, Mathias Versichele < [email protected]> wrote: > Ok, this might be the most difficult question until now from me (especially > since I can't seem to fully understand synchronization). I'm using a Task > class to run a background task asynchronously, so that the UI stays > responsive and my activityMeter keeps me informed about the progress of the > task. The problem now is, that somewhere I do this: > > private Process process; > > ... > > for loop { > > process = new Process(...) > process.execute(new TaskAdapter<String>(tl)); > > other code... > } > > the Process class extends the Task class. If my for loop gets called only > once everything works perfect. Otherwise, though, the code keeps running and > the process variable gets re-initialized with every loop until finally only > the last run of the loop makes the process run completely (with my UI acting > accordingly). What do I have to do to make the code stop after the > process.execute() line ? I already tried the wait and notify methods, but > they gave me errors until I used the synchronized keyword. Then, however, > the processes run correctly but my UI freezes (indefinitely). > > I'm kind of stuck here... is using the Task class the right way to go or > are there better ways for running threads in the background keeping my UI > nice and healthy ? > > Regards > > -- > Mathias Versichele > Bio-ir milieutechnologie / Msc. geografie > Oudburgstraat 16 > 9240 Zele > 0485/16.07.08 >
