Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Eclipse Jobs framework 3.0.2
Eclipse Jobs framework 3.0.2 [message #283468] Sun, 03 April 2005 19:40 Go to next message
Simon Lever is currently offline Simon LeverFriend
Messages: 8
Registered: July 2009
Junior Member
Hi,

I have been creating a plugin within Eclipse working entirely on version
3.0.1.

One of my requirements is that I need to find out when a java program has
completely finished executing in the console either by natural termination
or user termination by clicking the red terminate button. I successfully
did this in version 3.0.1 by adding an IJobChangeListener to the
platform's job manager:

final IJobManager jobManager = Platform.getJobManager();

then adding a IJobChangeListener to this implementing the done() method
only by using the JobChangeAdapter class, which has the signature:

public void done(IJobChangeEvent event) {...


I then monitor all the jobs that have been "done" and I found that the job
that is lastly done when a java program is terminated either naturally or
by user interaction is the job with the name "Process monitor". (I found
this out by examining the "Progress" view when executing a java program).
I find this out by:

if (event.getJob().getName().equals("Process monitor")) {...


I have now upgraded to eclipse 3.0.2 and it appears that the jobs
framework has changed where this job is no longer processed and
consequently I have no way of knowing when a java program has terminated,
which is the critical part of my plugin. I thought at first that the Job
name had changed, but in fact no jobs are done to notify a java program
has finished executing in 3.0.2. Hence my plugin no longer works. I can't
find any documentation at all either relating to this apparent change.


My question is then, is there any reason why this was removed from the
latest eclipse version and is there any other possible way of finding out
when a java program has finished executing?

Many Thanks,

Simon.
Re: How to listen for process termination [message #283507 is a reply to message #283468] Mon, 04 April 2005 18:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: john.eclipsefaq.org

Your problem is unrelated to the Jobs framework. The debugger was using
a job to listen for process termination. This job was changed to a
simple java.lang.Thread in the 3.0.2 release. Here is a bug with the
details:

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

You might want to ask the same question with a different subject line to
find out the best way to listen for process termination. Your previous
approach of listening for a job with a given name was brittle, as it
depended on an implementation detail of the debugger's launch framework.
The launch framework fires an event when processes terminate, you just
need to figure out where to attach a listener to get this information.
--

Simon Lever wrote:
> Hi,
>
> I have been creating a plugin within Eclipse working entirely on version
> 3.0.1.
> One of my requirements is that I need to find out when a java program
> has completely finished executing in the console either by natural
> termination or user termination by clicking the red terminate button. I
> successfully did this in version 3.0.1 by adding an IJobChangeListener
> to the platform's job manager:
>
> final IJobManager jobManager = Platform.getJobManager();
>
> then adding a IJobChangeListener to this implementing the done() method
> only by using the JobChangeAdapter class, which has the signature:
>
> public void done(IJobChangeEvent event) {...
>
>
> I then monitor all the jobs that have been "done" and I found that the
> job that is lastly done when a java program is terminated either
> naturally or by user interaction is the job with the name "Process
> monitor". (I found this out by examining the "Progress" view when
> executing a java program). I find this out by:
>
> if (event.getJob().getName().equals("Process monitor")) {...
>
>
> I have now upgraded to eclipse 3.0.2 and it appears that the jobs
> framework has changed where this job is no longer processed and
> consequently I have no way of knowing when a java program has
> terminated, which is the critical part of my plugin. I thought at first
> that the Job name had changed, but in fact no jobs are done to notify a
> java program has finished executing in 3.0.2. Hence my plugin no longer
> works. I can't find any documentation at all either relating to this
> apparent change.
>
>
> My question is then, is there any reason why this was removed from the
> latest eclipse version and is there any other possible way of finding
> out when a java program has finished executing?
>
> Many Thanks,
>
> Simon.
>
>
>
>
>
>
Re: How to listen for process termination [message #283513 is a reply to message #283507] Mon, 04 April 2005 21:02 Go to previous message
Simon Lever is currently offline Simon LeverFriend
Messages: 8
Registered: July 2009
Junior Member
Thanks John for pointing me in the right direction. I've solved it now!:)


I used the DebugPlugin class to monitor debug event notification. I used
the following code if anyone else wishes to do this: -


IDebugEventSetListener listener = new IDebugEventSetListener() {

public void handleDebugEvents(DebugEvent[] events) {

System.out.println(events[0]);
if (events[0].getKind() == DebugEvent.TERMINATE)
//make sure we stop listening for events to
//relinquish resources

DebugPlugin.getDefault().removeDebugEventListener(this);
}

};

DebugPlugin.getDefault().addDebugEventListener(listener);





Simon.
Previous Topic:Export issues with M6 based build...
Next Topic:Ant build script can't find compiler adapter
Goto Forum:
  


Current Time: Fri Aug 16 20:44:40 GMT 2024

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

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

Back to the top