KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jmx > snmp > tasks > Task


1 // NPCTE fix for bugId 4510777, esc 532372, MR October 2001
2
// file Task.java created for this bug fix
3
/*
4  * @(#)file Task.java
5  * @(#)author Sun Microsystems, Inc.
6  * @(#)version 1.2
7  * @(#)date 01/10/03
8  *
9  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
10  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
11  */

12 package com.sun.jmx.snmp.tasks;
13
14 /**
15  * This interface is implemented by objects that can be executed
16  * by a {@link com.sun.jmx.snmp.tasks.TaskServer}.
17  * <p>A <code>Task</code> object implements two methods:
18  * <ul><li><code>public void run(): </code> from
19  * {@link java.lang.Runnable}</li>
20  * <ul>This method is called by the {@link com.sun.jmx.snmp.tasks.TaskServer}
21  * when the task is executed.</ul>
22  * <li><code>public void cancel(): </code></li>
23  * <ul>This method is called by the {@link com.sun.jmx.snmp.tasks.TaskServer}
24  * if the <code>TaskServer</code> is stopped before the
25  * <code>Task</code> is executed.</ul>
26  * </ul>
27  * An implementation of {@link com.sun.jmx.snmp.tasks.TaskServer} shall call
28  * either <code>run()</code> or <code>cancel()</code>.
29  * Whether the task is executed synchronously in the current
30  * thread (when calling <code>TaskServer.submitTask()</code> or in a new
31  * thread dedicated to the task, or in a daemon thread, depends on the
32  * implementation of the <code>TaskServer</code> through which the task
33  * is executed.
34  * <p>The implementation of <code>Task</code> must not make any
35  * assumption on the implementation of the <code>TaskServer</code> through
36  * which it will be executed.
37  * <p><b>This API is a Sun Microsystems internal API and is subject
38  * to change without notice.</b></p>
39  * @see com.sun.jmx.snmp.tasks.TaskServer
40  *
41  * @since 1.5
42  **/

43 public interface Task extends Runnable JavaDoc {
44     /**
45      * Cancel the submitted task.
46      * The implementation of this method is Task-implementation dependent.
47      * It could involve some message logging, or even call the run() method.
48      * Note that only one of run() or cancel() will be called - and exactly
49      * one.
50      **/

51     public void cancel();
52 }
53
Popular Tags