Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Eclipse job ui dead when upload big data.
Eclipse job ui dead when upload big data. [message #653307] Wed, 09 February 2011 04:58 Go to next message
popjxc is currently offline 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 10:06 Go to previous messageGo to next message
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
Re: Eclipse job ui dead when upload big data. [message #653501 is a reply to message #653374] Wed, 09 February 2011 20:50 Go to previous messageGo to next message
popjxc is currently offline popjxc
Messages: 36
Registered: March 2010
Member
Hi Rich Kulp:
The hint is 283526, bigger than BEST_BEFORE.

Could you give me a way to dig into the problem?

Thanks~

Eclipse User wrote on Wed, 09 February 2011 10:06
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

Re: Eclipse job ui dead when upload big data. [message #653503 is a reply to message #653501] Wed, 09 February 2011 20:54 Go to previous messageGo to next message
popjxc is currently offline popjxc
Messages: 36
Registered: March 2010
Member
More information, if I change code to: job.setUser(false), this problem will no happen again, but I need the progress bar..
Re: Eclipse job ui dead when upload big data. [message #653508 is a reply to message #653503] Wed, 09 February 2011 21:22 Go to previous message
popjxc is currently offline popjxc
Messages: 36
Registered: March 2010
Member
Sorry, This is a stupid mistake. The reason is when I upload big text data, I use monitor.setTaskName(bigTextData), so the job UI use a long to redraw the task name label, and make the UI blocked... Crying or Very Sad

I think it is better to make setTaskName method to cut the argument when it is to big.

Thanks.

popjxc

[Updated on: Wed, 09 February 2011 21:23]

Report message to a moderator

Previous Topic:Why is commons-logging included in the infocenter WAR file?
Next Topic:Project import loses some files
Goto Forum:
  


Current Time: Sat Aug 30 22:36:54 EDT 2014

Powered by FUDForum. Page generated in 0.05655 seconds