01: /*
02: *
03: *
04: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package java.lang;
28:
29: /**
30: * The <code>Runnable</code> interface should be implemented by any
31: * class whose instances are intended to be executed by a thread. The
32: * class must define a method of no arguments called <code>run</code>.
33: * <p>
34: * This interface is designed to provide a common protocol for objects that
35: * wish to execute code while they are active. For example,
36: * <code>Runnable</code> is implemented by class <code>Thread</code>.
37: * Being active simply means that a thread has been started and has not
38: * yet been stopped.
39: * <p>
40: * In addition, <code>Runnable</code> provides the means for a class to be
41: * active while not subclassing <code>Thread</code>. A class that implements
42: * <code>Runnable</code> can run without subclassing <code>Thread</code>
43: * by instantiating a <code>Thread</code> instance and passing itself in
44: * as the target. In most cases, the <code>Runnable</code> interface should
45: * be used if you are only planning to override the <code>run()</code>
46: * method and no other <code>Thread</code> methods.
47: * This is important because classes should not be subclassed
48: * unless the programmer intends on modifying or enhancing the fundamental
49: * behavior of the class.
50: *
51: * @version 12/17/01 (CLDC 1.1)
52: * @see java.lang.Thread
53: * @since JDK1.0, CLDC 1.0
54: */
55: public interface Runnable {
56: /**
57: * When an object implementing interface <code>Runnable</code> is used
58: * to create a thread, starting the thread causes the object's
59: * <code>run</code> method to be called in that separately executing
60: * thread.
61: * <p>
62: * The general contract of the method <code>run</code> is that it may
63: * take any action whatsoever.
64: *
65: * @see java.lang.Thread#run()
66: */
67: public abstract void run();
68: }
|