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.