Home » Eclipse Projects » Rich Client Platform (RCP) » Jobs are freezing my whole app
Jobs are freezing my whole app [message #513086] |
Mon, 08 February 2010 14:18 |
Tobias Hoppenthaler Messages: 21 Registered: July 2009 |
Junior Member |
|
|
Hi there,
I am trying to invoke a bunch of jobs in order to generate files. Each
job generates a bunch of files from a source file. My Problem is, that I
do not get any progress information at all, i.e. I do not get the
progress bar dialog, that I get when I invoke a single job. Additionally
my application is rendered unusable. I can see the workers being invoked
in the debug view and after a while, when all work is done, I can use
the app again, but actually I wanted to use jobs in order to make the
app usable all the way during the work is being done. Any ideas, what I
am donig wrong? See source below.
Thanks,
Tobias
##############SOURCE###############
ArrayList<Job> jobList = new ArrayList<Job>();
IProgressMonitor pm = Job.getJobManager().createProgressGroup();
pm.beginTask("FLW",fileListFLW.size());
for (String file : fileListFLW) {
Job job = new GenerateJob(file);
job.setUser(true);
jobList.add(job);
job.setProgressGroup(pm, fileListFLW.size());
job.schedule();
}
for (Job job : jobList) {
if (pm.isCanceled()) {
return;a
}
try {
job.join();
pm.worked(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
pm.done();
}
}
private class GenerateFlowJob extends Job {
protected String file, outputDir, language;
public GenerateFlowJob(String file,
String outputDir, String language) {
super(file);
this.file = file;
this.outputDir = outputDir;
this.language = language;
}
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask(this.file, IProgressMonitor.UNKNOWN);
FlowGeneratorHandler.generateFlow(file,
outputDir, language);
monitor.done();
return Status.OK_STATUS;
}
}
|
|
|
Re: Jobs are freezing my whole app [message #513153 is a reply to message #513086] |
Mon, 08 February 2010 23:50 |
Prakash G.R. Messages: 621 Registered: July 2009 |
Senior Member |
|
|
On 09/02/10 12:33 AM, Tobias Hoppenthaler wrote:
> Hi there,
> I am trying to invoke a bunch of jobs in order to generate files. Each
> job generates a bunch of files from a source file. My Problem is, that I
> do not get any progress information at all, i.e. I do not get the
> progress bar dialog, that I get when I invoke a single job. Additionally
> my application is rendered unusable. I can see the workers being invoked
> in the debug view and after a while, when all work is done, I can use
> the app again, but actually I wanted to use jobs in order to make the
> app usable all the way during the work is being done. Any ideas, what I
> am donig wrong? See source below.
Why don't you generate all the files in a single job?
- Prakash
Platform UI Team, IBM
Blog <http://blog.eclipse-tips.com>
Twitter <http://www.twitter.com/Eclipse_Tips>
|
|
| | |
Re: Jobs are freezing my whole app [message #513345 is a reply to message #513086] |
Tue, 09 February 2010 19:30 |
Tobias Hoppenthaler Messages: 21 Registered: July 2009 |
Junior Member |
|
|
It seems that my problem consisted of two components:
a) job.join() was called for each job in the command handler and that
seemed to render my app unusable.
b) the progress view was in my app
When I removed the join clause from my code, suddenly it worked, but I
had no progress info. Then I added the progress view and everything was
fine.
Cheers,
Tobias
On 08.02.2010 20:03, Tobias Hoppenthaler wrote:
> Hi there,
> I am trying to invoke a bunch of jobs in order to generate files. Each
> job generates a bunch of files from a source file. My Problem is, that I
> do not get any progress information at all, i.e. I do not get the
> progress bar dialog, that I get when I invoke a single job. Additionally
> my application is rendered unusable. I can see the workers being invoked
> in the debug view and after a while, when all work is done, I can use
> the app again, but actually I wanted to use jobs in order to make the
> app usable all the way during the work is being done. Any ideas, what I
> am donig wrong? See source below.
>
> Thanks,
>
> Tobias
>
|
|
|
Goto Forum:
Current Time: Sat Oct 19 17:25:43 GMT 2024
Powered by FUDForum. Page generated in 0.03979 seconds
|