KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > runtime > jobs > IJobChangeListener


1 /*******************************************************************************
2  * Copyright (c) 2003, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.runtime.jobs;
12
13 /**
14  * Callback interface for clients interested in being notified when jobs change state.
15  * <p>
16  * A single job listener instance can be added either to the job manager, for notification
17  * of all scheduled jobs, or to any set of individual jobs. A single listener instance should
18  * not be added to both the job manager, and to individual jobs (such a listener may
19  * receive duplicate notifications).
20  * </p><p>
21  * Clients should not rely on the result of the <code>Job#getState()</code>
22  * method on jobs for which notification is occurring. Listeners are notified of
23  * all job state changes, but whether the state change occurs before, during, or
24  * after listeners are notified is unspecified.
25  * </p><p>
26  * Clients may implement this interface.
27  * </p>
28  * @see JobChangeAdapter
29  * @see IJobManager#addJobChangeListener(IJobChangeListener)
30  * @see IJobManager#removeJobChangeListener(IJobChangeListener)
31  * @see Job#addJobChangeListener(IJobChangeListener)
32  * @see Job#getState()
33  * @see Job#removeJobChangeListener(IJobChangeListener)
34  * @since 3.0
35  */

36 public interface IJobChangeListener {
37     /**
38      * Notification that a job is about to be run. Listeners are allowed to sleep, cancel,
39      * or change the priority of the job before it is started (and as a result may prevent
40      * the run from actually occurring).
41      *
42      * @param event the event details
43      */

44     public void aboutToRun(IJobChangeEvent event);
45
46     /**
47      * Notification that a job was previously sleeping and has now been rescheduled
48      * to run.
49      *
50      * @param event the event details
51      */

52     public void awake(IJobChangeEvent event);
53
54     /**
55      * Notification that a job has completed execution, either due to cancelation, successful
56      * completion, or failure. The event status object indicates how the job finished,
57      * and the reason for failure, if applicable.
58      *
59      * @param event the event details
60      */

61     public void done(IJobChangeEvent event);
62
63     /**
64      * Notification that a job has started running.
65      *
66      * @param event the event details
67      */

68     public void running(IJobChangeEvent event);
69
70     /**
71      * Notification that a job is being added to the queue of scheduled jobs.
72      * The event details includes the scheduling delay before the job should start
73      * running.
74      *
75      * @param event the event details, including the job instance and the scheduling
76      * delay
77      */

78     public void scheduled(IJobChangeEvent event);
79
80     /**
81      * Notification that a job was waiting to run and has now been put in the
82      * sleeping state.
83      *
84      * @param event the event details
85      */

86     public void sleeping(IJobChangeEvent event);
87 }
88
Popular Tags