Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » how to kill a job
how to kill a job [message #443729] Fri, 03 February 2006 05:24 Go to next message
Eclipse UserFriend
Hi all,

Hope someone can point me in the right direction...

I have got my application using job to perform few CORBA call to a server...



let say that at some point my server hangs ... and so the call inside my
job; at the point even if I press the cancel button (in the JOB UI) there is
no way for me to reach the monitor.isCanceled() checks .



Any idea about what I could do ... except taking the id of the job (thread)
and killing it brutally :-(



Regards

Kar
Re: how to kill a job [message #443734 is a reply to message #443729] Fri, 03 February 2006 06:55 Go to previous messageGo to next message
Eclipse UserFriend
That's why you shouldn't run jobs in the UI thread. Fire it up in a non-UI thread (remembering to fire separate UI jobs if you need it) and you'll be able to click on the cancel button.

Alex.
Re: how to kill a job [message #443743 is a reply to message #443734] Fri, 03 February 2006 10:12 Go to previous messageGo to next message
Eclipse UserFriend
I think he's running outside the UI thread, but because it's blocked on
a CORBA call it cannot check the progress monitor for cancellation.
Unfortunately, there is no safe way in Java to kill an unresponsive
thread. The only solution I know of is to use non-blocking server
calls, if possible. Some discussion can be found here:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=123075
--

Alex Blewitt wrote:
> That's why you shouldn't run jobs in the UI thread. Fire it up in a non-UI thread (remembering to fire separate UI jobs if you need it) and you'll be able to click on the cancel button.
>
> Alex.
Re: how to kill a job [message #443763 is a reply to message #443743] Fri, 03 February 2006 10:59 Go to previous messageGo to next message
Eclipse UserFriend
Yes, re-reading the original question does seem to imply the UI thread is working and I misread it. That's what you get for writing replies late at night ...

I wonder if the corba call has some kind of timeout that can be used, or whether it really is a long-running thread.

Perhaps if a job can't be killed (because it's unresponsive) then it should just be removed from the jobs list to hide its existence? Zombie proceses work much the same way.

Alex.
Re: how to kill a job [message #443873 is a reply to message #443763] Mon, 06 February 2006 03:59 Go to previous messageGo to next message
Eclipse UserFriend
Thanks guys for your help...



I did try to solve my problem registering the job monitor with an external
thread that start in the same moment the job is scheduled.



In this way the external thread is still able to react to a
monitor.iscancell call even if the main job is waiting for a sort of return
from the CORBA call.



What I'm not sure at this point is how to go ahead...

I have send a



job.cancel();
job.done(Status.CANCEL_STATUS);



this has the effect to close the job (or at least the progress ui) ... but
still something is going on and on once I kill the server who is responsible
for the lock of the CORBA call - i.e. I can see all the call still appears
in the log as my job is still working



What am I doing wrong...?



Regards

Kar


"Alex Blewitt" <alex_blewitt@yahoo.com> wrote in message
news:17517491.1138982374996.JavaMail.root@cp1.javalobby.org...
> Yes, re-reading the original question does seem to imply the UI thread is
> working and I misread it. That's what you get for writing replies late at
> night ...
>
> I wonder if the corba call has some kind of timeout that can be used, or
> whether it really is a long-running thread.
>
> Perhaps if a job can't be killed (because it's unresponsive) then it
> should just be removed from the jobs list to hide its existence? Zombie
> proceses work much the same way.
>
> Alex.
Re: how to kill a job [message #443963 is a reply to message #443873] Tue, 07 February 2006 13:36 Go to previous message
Eclipse UserFriend
You shouldn't be calling Job.done, that's a fairly specialized method
for jobs that complete asynchronously in a different thread (such as a
UIJob). A job is only "done" when its run method returns. I think you
have the right idea, but are doing it backwards. I suggest having the
separate thread making the CORBA call, and the job's run method
periodically checking the monitor for cancelation. When the cancelation
occurs, interrupt the thread making the CORBA call, if possible, and
signal completion by returning from the job's run method.
--

KarSc wrote:
> Thanks guys for your help...
>
>
>
> I did try to solve my problem registering the job monitor with an external
> thread that start in the same moment the job is scheduled.
>
>
>
> In this way the external thread is still able to react to a
> monitor.iscancell call even if the main job is waiting for a sort of return
> from the CORBA call.
>
>
>
> What I'm not sure at this point is how to go ahead...
>
> I have send a
>
>
>
> job.cancel();
> job.done(Status.CANCEL_STATUS);
>
>
>
> this has the effect to close the job (or at least the progress ui) ... but
> still something is going on and on once I kill the server who is responsible
> for the lock of the CORBA call - i.e. I can see all the call still appears
> in the log as my job is still working
>
>
>
> What am I doing wrong...?
>
>
>
> Regards
>
> Kar
>
>
> "Alex Blewitt" <alex_blewitt@yahoo.com> wrote in message
> news:17517491.1138982374996.JavaMail.root@cp1.javalobby.org...
>
>>Yes, re-reading the original question does seem to imply the UI thread is
>>working and I misread it. That's what you get for writing replies late at
>>night ...
>>
>>I wonder if the corba call has some kind of timeout that can be used, or
>>whether it really is a long-running thread.
>>
>>Perhaps if a job can't be killed (because it's unresponsive) then it
>>should just be removed from the jobs list to hide its existence? Zombie
>>proceses work much the same way.
>>
>>Alex.
>
>
>
Previous Topic:still problem with job ...
Next Topic:Discovering the defining plugin
Goto Forum:
  


Current Time: Sat Jun 21 20:26:52 EDT 2025

Powered by FUDForum. Page generated in 0.32557 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top