Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "FAQ How can I track the lifecycle of jobs?"

 
m
Line 1: Line 1:
''
+
It is quite simple to find out when jobs, including those owned by others, are scheduled, run, awoken, and finished. As with many other facilities in the Eclipse Platform, a simple listener suffices:
 
+
 
+
 
+
 
+
 
+
It is quite simple to find out when jobs, including those owned by others,
+
are scheduled, run, awoken, and finished. As with many other
+
facilities in the Eclipse Platform, a simple listener suffices:
+
 
<pre>
 
<pre>
 
   IJobManager manager = Platform.getJobManager();
 
   IJobManager manager = Platform.getJobManager();
Line 18: Line 10:
 
</pre>
 
</pre>
  
 
+
By subclassing <tt>JobChangeAdapter</tt>, rather than directly implementing <tt>IJobChangeListener</tt>, you can pick and choose which job change events you want to listen to. Note that the <tt>done</tt> event is sent regardless of whether the job was cancelled or failed to complete, and the result status in the job change event will tell you how it ended.
 
+
By subclassing <tt>JobChangeAdapter</tt>, rather than directly
+
implementing <tt>IJobChangeListener</tt>, you can pick and  
+
choose which job change events you want to listen to. Note
+
that the <tt>done</tt> event is sent regardless of whether the
+
job was cancelled or failed to complete, and the result status in
+
the job change event will tell you how it ended.
+
 
+
 
+
 
+
 
+
  
 
== See Also: ==
 
== See Also: ==
 +
*[[FAQ Does the platform have support for concurrency?]]
 +
*[[FAQ How do I prevent two jobs from running at the same time?]]
  
 
+
{{Template:FAQ_Tagline}}
[[FAQ_Does_the_platform_have_support_for_concurrency%3F]]
+
 
+
 
+
[[FAQ_How_do_I_find_out_whether_a_particular_job_is_running%3F]]
+
 
+
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
+

Revision as of 23:19, 1 June 2006

It is quite simple to find out when jobs, including those owned by others, are scheduled, run, awoken, and finished. As with many other facilities in the Eclipse Platform, a simple listener suffices:

   IJobManager manager = Platform.getJobManager();
   manager.addJobChangeListener(new JobChangeAdapter() {
        public void scheduled(IJobChangeEvent event) {
        	Job job = event.getJob();
            System.out.println("Job scheduled: "+job.getName());
        }
    });

By subclassing JobChangeAdapter, rather than directly implementing IJobChangeListener, you can pick and choose which job change events you want to listen to. Note that the done event is sent regardless of whether the job was cancelled or failed to complete, and the result status in the job change event will tell you how it ended.

See Also:


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.