Eclipse job ui dead when upload big data. [message #653307] |
Wed, 09 February 2011 09:58 |
popjxc Messages: 36 Registered: March 2010 |
Member |
|
|
I use job api for a long time, and I think it is very easy to use. But those days I meet a problem very hard to debug:
I my RCP I need to upload some data to a http server, and I use restlet client api, and http put method. I am so love job api that I put those operation in a job. I'm pretty sure the job is not running in the UI thread.
When I upload big data(maybe big than 1MB), the Job UI dead and No response. So I debug those code, the code "monitor.done();" and "return Status.OK_STATUS;" in job class has all been executed, but Job UI still dead there for some minutes.
my code :
final Job job = new Job(Messages.ProjectAllCheckInAction_3) {
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask(getName(), IProgressMonitor.UNKNOWN);
try {
//restlet client put big data to a http server
} catch (Exception e) {
return Status.CANCEL_STATUS;
}finally {
monitor.done();
}
return Status.OK_STATUS;
}
public boolean belongsTo(Object family) {
return ADIJobManager.SVN_TRANSITION_FAMILY.equals(family);
}
};
job.setUser(true);
job.schedule();
System.out.println(11);
After UI is dead, I suspend the job thread in debug mode, and I found the code is stoped in WorkerPool class startJob() method:
while (manager.isActive() && job == null) {
long hint = manager.sleepHint();
if (hint > 0)
//thread waiting here sleep(Math.min(hint,BEST_BEFORE));
job = manager.startJob();
Does anybody know where the problem is?
Thanks!
|
|
|
Re: Eclipse job ui dead when upload big data. [message #653374 is a reply to message #653307] |
Wed, 09 February 2011 15:06 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NOSPAM.ibm.com
> while (manager.isActive() && job == null) {
> long hint = manager.sleepHint();
> if (hint > 0)
> //thread waiting here sleep(Math.min(hint,BEST_BEFORE));
> job = manager.startJob();
>
Did you notice what the argument to sleep was? If it happened to be 0
then it sleeps indefinitely. Maybe hint is being returned as 0.
--
Thanks,
Rich Kulp
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03457 seconds