ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ThreadFactory.java
Revision: 1.5
Committed: Sat Dec 20 15:48:27 2003 UTC (20 years, 5 months ago) by dl
Branch: MAIN
Changes since 1.4: +13 -0 lines
Log Message:
rename ScheduledExecutorService factory methods; minor doc touch-ups

File Contents

# User Rev Content
1 tim 1.1 /*
2 dl 1.2 * Written by Doug Lea with assistance from members of JCP JSR-166
3     * Expert Group and released to the public domain. Use, modify, and
4     * redistribute this code in any way without acknowledgement.
5 tim 1.1 */
6    
7     package java.util.concurrent;
8    
9     /**
10     * An object that creates new threads on demand. Using thread factories
11     * removes hardwiring of calls to {@link Thread#Thread(Runnable) new Thread},
12     * enabling applications to use special thread subclasses, priorities, etc.
13     *
14 dl 1.5 * <p>
15     * The simplest implementation of this interface is just:
16     * <pre>
17     * class SimpleThreadFactory implements ThreadFactory {
18     * public Thread newThread(Runnable r) {
19     * return new Thread(r);
20     * }
21     * }
22     * </pre>
23     *
24     * The {@link Executors#defaultThreadFactory} method provides a more
25     * useful simple implementation, that sets the created thread context
26     * to known values before returning it.
27 tim 1.1 * @since 1.5
28 dl 1.3 * @author Doug Lea
29 tim 1.1 */
30     public interface ThreadFactory {
31    
32     /**
33     * Constructs a new <tt>Thread</tt>. Implementations may also initialize
34     * priority, name, daemon status, <tt>ThreadGroup</tt>, etc.
35     *
36     * @param r a runnable to be executed by new thread instance
37     * @return constructed thread
38     */
39     Thread newThread(Runnable r);
40     }