public interface ThreadFactory
new Thread
工厂硬,使应用程序能够使用特殊的线程类,优先,等
这个接口的最简单的实现就是:
class SimpleThreadFactory implements ThreadFactory {
public Thread newThread(Runnable r) {
return new Thread(r);
}
}
的
Executors.defaultThreadFactory()
方法提供了更多有用的简单实现,使创建的线程上下文中的已知值然后返回。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.