how to kill a job [message #443729] |
Fri, 03 February 2006 05:24  |
Eclipse User |
|
|
|
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 #443963 is a reply to message #443873] |
Tue, 07 February 2006 13:36  |
Eclipse User |
|
|
|
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.
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.32557 seconds